Repository navigation
Conversation
Contributor
|
@danhandev Please rebase |
Activating a savings, fixed deposit or recurring deposit account can post an initial deposit, but activation loaded the account without checking the user's office hierarchy, so a user from an unrelated office could activate it. Load the account through the in-user-scope assemblers added in FINERACT-2639, so such a user gets 403 and the account stays approved. GSIM activation and bulk import go through the same methods and are covered as well. Assisted-By: claude-opus-5-5
danhandev
force-pushed
the
FINERACT-2982
branch
from
October 30, 2026 00:37
d40566a to
f7bc606
Compare
Author
|
Rebased on develop, thanks. The earlier build-core failure was the SavingsAccountRepositoryWrapperLockOrderTest compile error, fixed on develop by FINERACT-2968. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to FINERACT-2639 (#6698), covering the deposit-account activation part of FINERACT-2982.
Original issue
Activating a savings, fixed deposit or recurring deposit account can post an initial deposit (minimum opening balance, FD deposit amount, or a transfer from the linked savings account). Activation loaded the account with
assembleFrom(...)and never checked the user's office, so a user from a sibling office could activate another office's account and post that deposit.What changed
SavingsAccountWritePlatformServiceJpaRepositoryImpl.activate,DepositAccountWritePlatformServiceJpaRepositoryImpl.activateFDAccountandactivateRDAccountnow load the account with theassembleFromInUserScope(...)loaders from FINERACT-2639. No other logic changes.Paths that reach these methods and are therefore covered:
POST /savingsaccounts/{id}?command=activate,/fixeddepositaccounts/...,/recurringdepositaccounts/...gsimActivatecallsactivatefor each child account). Group members must share the group's office, so a user in scope of the group is in scope of every child.SavingsImportHandler,FixedDepositImportHandler,RecurringDepositImportHandlersubmit the same activation commands).The transfer from a linked savings account during FD/RD activation is not checked separately: the linked account must belong to the same client, and
SavingsAccount.office()derives the office from the client, so both accounts are always in the same office.Side effect (behaviour change)
A non-head-office user can no longer activate an account outside their office hierarchy; they now get 403 and the account stays approved. Users in the account's office or a parent office, including head-office users, are unaffected. This may be worth a line in the release notes.
How it is covered
SavingsAccountWritePlatformServiceJpaRepositoryImplTest.activate_shouldRejectUserOutsideAccountOfficeHierarchySavingsOfficeHierarchyAccessIntegrationTestandRecurringDepositOfficeHierarchyAccessIntegrationTest, and a newFixedDepositOfficeHierarchyAccessIntegrationTest. The sibling-office user is given theACTIVATE_*permission, so the 403 comes from the office check, and the test asserts the hierarchy error message. Each test also checks that a user from the account's office can still activate and that the initial deposit is posted.Out of scope, found while tracing (not changed here)
ClientWritePlatformServiceJpaRepositoryImpl.activateClient→SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl.createActiveApplication) creates an active savings account and posts the minimum opening balance. Client activation loads the client without an office check (ClientRepositoryWrapper.findOneWithNotFoundDetection), so this path is still open. Fixing it would change client activation for all clients, so I left it out and noted it on the Jira ticket.Checklist