RBAC: prioritise directly applied permissions over inherited permissions (#80212)

show directly applied permissions over inherited permissions
This commit is contained in:
Ieva 2024-01-11 11:01:19 +00:00 committed by GitHub
parent 310ad0474c
commit 0f4e123de0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,6 +27,12 @@ export const PermissionList = ({ title, items, compareKey, permissionLevels, can
if (item.actions.length > keep[key].actions.length) {
keep[key] = item;
continue;
}
// If the same permission has been inherited and applied directly, keep the one that is applied directly
if (item.actions.length === keep[key].actions.length && !item.isInherited) {
keep[key] = item;
}
}
return Object.keys(keep).map((k) => keep[k]);