feature/viewPermission store snake case instead of camel case in database - step5

This commit is contained in:
hongwei 2025-07-11 19:25:31 +02:00
parent 177f6f3e2a
commit f0bb8caca2
3 changed files with 8 additions and 9 deletions

View File

@ -136,6 +136,7 @@ object SwaggerDefinitionsJSON {
which_alias_to_use = "family",
hide_metadata_if_alias_used = false,
allowed_actions = List(
CAN_EDIT_OWNER_COMMENT,
CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT,
CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT,
CAN_SEE_TRANSACTION_METADATA,

View File

@ -37,10 +37,11 @@ object BalanceNewStyle {
Future {
val (views, accountAccesses) = Views.views.vend.privateViewsUserCanAccessAtBank(user, bankId)
// Filter views which can read the balance
// println("xxxxxxx")
println(views.map(_.allowed_actions))
val canSeeBankAccountBalanceViews = views.filter(_.allowed_actions.exists( _ == CAN_SEE_BANK_ACCOUNT_BALANCE))
// Filter accounts the user has permission to see balances and remove duplicates
val viewsWithActions = views.map(view => (view, view.allowed_actions))
val canSeeBankAccountBalanceViews = viewsWithActions.filter {
case (_, actions) => actions.contains(CAN_SEE_BANK_ACCOUNT_BALANCE)
}.map(_._1)
val allowedAccounts = APIUtil.intersectAccountAccessAndView(accountAccesses, canSeeBankAccountBalanceViews)
allowedAccounts
} map {

View File

@ -71,11 +71,8 @@ object LocalMappedConnectorInternal extends MdcLoggable {
fromBankIdAccountId = BankIdAccountId(fromAccount.bankId, fromAccount.accountId)
view <- NewStyle.function.checkAccountAccessAndGetView(viewId, fromBankIdAccountId, Full(user), callContext)
_ <- Helper.booleanToFuture(InsufficientAuthorisationToCreateTransactionRequest, cc = callContext) {
// println("xxxxxxxxx")
// println(view.allowed_actions)
// println(CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT)
// println(view.allowed_actions.exists(_ ==CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT))
view.allowed_actions.exists(_ ==CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT)
val allowed_actions = view.allowed_actions
allowed_actions.exists(_ ==CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT)
}
(paymentLimit, callContext) <- Connector.connector.vend.getPaymentLimit(