Skip to content

Commit 283925b

Browse files
committed
docfix: Updating Ressource Doc for grantUserAccessToViewById to better
reflect functionality
1 parent 9bcbefe commit 283925b

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

obp-api/src/main/scala/code/api/v5_1_0/APIMethods510.scala

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,7 +2232,7 @@ trait APIMethods510 {
22322232
grantorConsumerId = callContext.map(_.consumer.toOption.map(_.consumerId.get)).flatten.getOrElse("Unknown")
22332233
//this is from json body
22342234
granteeConsumerId = consentJson.consumer_id.getOrElse("Unknown")
2235-
2235+
22362236
// Log consent SCA skip check to ai.log
22372237
_ <- Future.successful {
22382238
println(s"[skip_consent_sca_for_consumer_id_pairs] Checking SCA skip for consent creation")
@@ -3618,9 +3618,37 @@ trait APIMethods510 {
36183618
"POST",
36193619
"/banks/BANK_ID/accounts/ACCOUNT_ID/views/VIEW_ID/account-access/grant",
36203620
"Grant User access to View",
3621-
s"""Grants the User identified by USER_ID access to the view identified.
3621+
s"""Grants the User identified by USER_ID access to the view on a bank account identified by VIEW_ID.
3622+
|
3623+
|${userAuthenticationMessage(true)} and the user needs to have appropriate permissions.
3624+
|
3625+
|**Permission Requirements:**
3626+
|The requesting user must have access to the source VIEW_ID and must possess specific grant permissions:
3627+
|
3628+
|**For System Views (e.g., owner, accountant, auditor, public etc.):**
3629+
|- The user's current view must have the target view listed in its `canGrantAccessToViews` field
3630+
|- Example: If granting access to "accountant" view, the user's view must include "accountant" in `canGrantAccessToViews`
3631+
|
3632+
|**For Custom Views (account-specific views):**
3633+
|- The user's current view must have the `can_grant_access_to_custom_views` permission in its `allowed_actions` field
3634+
|- This permission allows granting access to any custom view on the account
3635+
|
3636+
|**Security Checks Performed:**
3637+
|1. User authentication validation
3638+
|2. JSON format validation (USER_ID and VIEW_ID required)
3639+
|3. Permission authorization via `APIUtil.canGrantAccessToView()`
3640+
|4. Target user existence verification
3641+
|5. Target view existence and type validation (system vs custom)
3642+
|6. Final access grant operation in database
3643+
|
3644+
|**Final Database Operation:**
3645+
|The system creates an `AccountAccess` record linking the user to the view if one doesn't already exist.
3646+
|This operation includes:
3647+
|- Duplicate check: Prevents creating duplicate access records (idempotent operation)
3648+
|- Public view restriction: Blocks access to public views if disabled instance-wide
3649+
|- Database constraint validation: Ensures referential integrity
36223650
|
3623-
|${userAuthenticationMessage(true)} and the user needs to be account holder.
3651+
|**Note:** The permission model ensures users can only delegate access rights they themselves possess or are explicitly authorized to grant.
36243652
|
36253653
|""",
36263654
postAccountAccessJsonV510,

0 commit comments

Comments
 (0)