Refactor privilege management to support hierarchical privilege keys
- Updated privilege key structure to use a 3- or 4-part dotted hierarchy (e.g., `GROUP.PARENT.MODULE`). - Modified the `RequirePrivilege` decorator to accept multiple keys, allowing for OR logic in privilege checks. - Enhanced `PrivilegesGuard` to validate against multiple privilege keys, improving access control logic. - Created migration scripts to update existing privilege keys in the database to the new format. - Updated related services, controllers, and tests to accommodate the new privilege key structure and validation logic.
This commit is contained in:
@@ -34,7 +34,7 @@ describe('CyclesService', () => {
|
||||
const employeesService = { findById: jest.fn(), findByCode: jest.fn() };
|
||||
const branchesService = { findById: jest.fn(), findByCode: jest.fn() };
|
||||
const customersService = { findById: jest.fn(), findByCode: jest.fn() };
|
||||
const privilegesService = { checkPermission: jest.fn() };
|
||||
const privilegesService = { checkPermission: jest.fn(), checkAnyPermission: jest.fn() };
|
||||
|
||||
const now = DateTime.fromUnixMs(1_700_000_000_000);
|
||||
const user: AuthUser = {
|
||||
|
||||
Reference in New Issue
Block a user