role api issue
This commit is contained in:
parent
3590fbb39f
commit
6ba17a3a6f
@ -2034,6 +2034,9 @@ paths:
|
||||
put:
|
||||
tags: [Roles]
|
||||
summary: Save permission matrix for role
|
||||
description: >
|
||||
Grants only actions that exist for each module. Sparse modules (e.g. SETTINGS view/edit,
|
||||
REPORTS/AUDIT_LOGS view/export) ignore true flags for actions that have no permission row.
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
|
||||
@ -406,8 +406,9 @@ const savePermissionMatrix = async (id, matrix, userId, requestId) => {
|
||||
const perm = catalog.find(
|
||||
(p) => p.module_id.toString() === String(row.module_id) && p.action === action
|
||||
);
|
||||
if (!perm)
|
||||
throw new ApiError(422, `Permission not found for module ${row.module_id}:${action}`);
|
||||
// Sparse modules (e.g. SETTINGS view/edit only, REPORTS view/export) have no row for
|
||||
// every action — ignore grants for actions that do not exist in the catalog.
|
||||
if (!perm) continue;
|
||||
permissionIds.push(perm.id);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user