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