feat(cashier): add role-based data filtering and pagination for teller workstation

- Add CashierRoleHelper service: detects CASHIER role via DB permission
  check, resolves cashier ID from staff/user linkage
- Role-based filtering on GET list endpoints (cashtransfer, cashsettlement,
  cashintercashier, cashexchange, cashreports): CASHIER sees only own data,
  ADMIN/HEAD sees all
- Pagination (offset/limit) added to all cashier list APIs returning
  standard Fineract Page format {totalFilteredRecords, pageItems}
- ShareCollectionApiResource: collect cash before account activation,
  post GL entries (Dr Cash Vault / Cr Share Sundry / Cr Income from Fees),
  mark charges paid to prevent duplicate GL on activation,
  GET status endpoint for collection check
- Migration 0315: grant READ_CLIENTKYC, READ_CLIENTNOMINEE, READ_ADDRESS,
  READ_FAMILYMEMBERS, READ_SAVINGSACCOUNT to CASHIER role

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jaanu423
2026-06-05 11:00:55 +05:30
co-authored by Claude Sonnet 4.6
parent 9d944d0196
commit 2371ad98b1
8 changed files with 260 additions and 15 deletions
@@ -342,4 +342,5 @@
<include file="parts/0312_grant_cashier_fd_rd_permissions.xml" relativeToChangelogFile="true"/>
<include file="parts/0313_alter_cash_exchange_add_columns.xml" relativeToChangelogFile="true"/>
<include file="parts/0314_cashier_staff_unique_constraint.xml" relativeToChangelogFile="true"/>
<include file="parts/0315_grant_cashier_transaction_entry_permissions.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
for licensing details.
-->
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
<!--
Grant additional READ permissions to the CASHIER role required for
the Cashier Transaction Entry screen to display full account details:
- READ_CLIENTKYC → PAN, Aadhaar, CKYC number
- READ_CLIENTNOMINEE → nominee list per account
- READ_ADDRESS → client address
- READ_FAMILYMEMBERS → S/D/W/H/O (guardian/spouse name)
- READ_SAVINGSACCOUNT → savings account detail fetch
-->
<changeSet id="0315_grant_cashier_transaction_entry_permissions" author="fineract">
<sql>
INSERT INTO m_role_permission (role_id, permission_id)
SELECT r.id, p.id
FROM m_role r
JOIN m_permission p ON p.code IN (
'READ_CLIENTKYC',
'READ_CLIENTNOMINEE',
'READ_ADDRESS',
'READ_FAMILYMEMBERS',
'READ_SAVINGSACCOUNT'
)
WHERE r.name = 'CASHIER'
AND NOT EXISTS (
SELECT 1 FROM m_role_permission rp
WHERE rp.role_id = r.id AND rp.permission_id = p.id
);
</sql>
<rollback>
DELETE FROM m_role_permission
WHERE role_id = (SELECT id FROM m_role WHERE name = 'CASHIER')
AND permission_id IN (
SELECT id FROM m_permission
WHERE code IN (
'READ_CLIENTKYC',
'READ_CLIENTNOMINEE',
'READ_ADDRESS',
'READ_FAMILYMEMBERS',
'READ_SAVINGSACCOUNT'
)
);
</rollback>
</changeSet>
</databaseChangeLog>