feat(clerk): add clerk role with cashier teller workstation permissions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
edaeb674d5
commit
6d0c1fe7f6
@@ -343,4 +343,5 @@
|
||||
<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"/>
|
||||
<include file="parts/0316_create_clerk_role_and_permissions.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
<?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">
|
||||
|
||||
<!--
|
||||
Step 1: Insert MENU_CLERK permission if it does not already exist.
|
||||
Used by the Angular shell to show/hide the Clerk nav item.
|
||||
-->
|
||||
<changeSet id="0316_insert_menu_clerk_permission" author="fineract">
|
||||
<sql>
|
||||
INSERT INTO m_permission (grouping, code, entity_name, action_name, can_maker_checker)
|
||||
SELECT 'heading_menu', 'MENU_CLERK', 'MENU', 'CLERK', false
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM m_permission WHERE code = 'MENU_CLERK'
|
||||
);
|
||||
</sql>
|
||||
<rollback>
|
||||
DELETE FROM m_permission WHERE code = 'MENU_CLERK';
|
||||
</rollback>
|
||||
</changeSet>
|
||||
|
||||
<!--
|
||||
Step 2: Create the Clerk role if it does not already exist.
|
||||
The Angular UI checks for role name 'Clerk' (case-insensitive) via isClerkUser().
|
||||
-->
|
||||
<changeSet id="0316_create_clerk_role" author="fineract">
|
||||
<sql>
|
||||
INSERT INTO m_role (name, description, is_disabled)
|
||||
SELECT 'Clerk', 'Clerk role with all application permissions for front-desk banking operations.', false
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM m_role WHERE LOWER(name) = 'clerk'
|
||||
);
|
||||
</sql>
|
||||
<rollback>
|
||||
DELETE FROM m_role_permission WHERE role_id = (SELECT id FROM m_role WHERE LOWER(name) = 'clerk');
|
||||
DELETE FROM m_role WHERE LOWER(name) = 'clerk';
|
||||
</rollback>
|
||||
</changeSet>
|
||||
|
||||
<!--
|
||||
Step 3: Grant ALL permissions to the Clerk role (mirrors current DB state where
|
||||
Clerk has all 1122 permissions — same as Super User).
|
||||
Idempotent: NOT EXISTS guard prevents duplicate entries.
|
||||
-->
|
||||
<changeSet id="0316_grant_all_permissions_to_clerk" author="fineract">
|
||||
<sql>
|
||||
INSERT INTO m_role_permission (role_id, permission_id)
|
||||
SELECT r.id, p.id
|
||||
FROM m_role r, m_permission p
|
||||
WHERE LOWER(r.name) = 'clerk'
|
||||
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 LOWER(name) = 'clerk');
|
||||
</rollback>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
Reference in New Issue
Block a user