mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
updated permission types
This commit is contained in:
parent
6b492db463
commit
03e7a9ca8c
@ -103,11 +103,11 @@ function usePermissionsManager(initialPermissions: Permission[]): {
|
||||
p.action === action &&
|
||||
p.collection === collectionName &&
|
||||
(
|
||||
(p.role === user?.role &&
|
||||
(p.policy === user?.role &&
|
||||
(
|
||||
!item || evaluatePermissions(p.permissions)
|
||||
)) ||
|
||||
(p.role == null &&
|
||||
(p.policy == null &&
|
||||
(
|
||||
(layer?.public_edit_items || item?.layer?.public_edit_items) &&
|
||||
(!item || evaluatePermissions(p.permissions))
|
||||
@ -116,13 +116,9 @@ function usePermissionsManager(initialPermissions: Permission[]): {
|
||||
);
|
||||
}
|
||||
},
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[permissions, user]
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
return { permissions, setPermissionApi, setPermissionData, setAdminRole, hasUserPermission };
|
||||
}
|
||||
|
||||
|
||||
@ -158,7 +158,7 @@ export type PermissionCondition = {
|
||||
|
||||
export type Permission = {
|
||||
id?: string;
|
||||
role: string;
|
||||
policy: string;
|
||||
collection: string;
|
||||
action: PermissionAction;
|
||||
permissions?: { // Optional, für spezifische Bedingungen wie `user_created`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user