* Revert "fix: remove fallback permssions on organization Id. (#22769)"
This reverts commit 30061c0d58.
Removes the manage permission concept and fallback logic to simplify
permission checking back to direct role-based checks.
* remove manage from workflows
* fix type error and remove manage from components
This commit is contained in:
1 parent
2922c8fe77
commit
ae738fae35
9 files changed
+22
-434
No files matched your search
-12
@@ -44,17 +44,5 @@ describe("usePermissions", () => {
|
||||
|
||||
expect(getResourcePermissionLevel("eventType", permissions)).toBe("all");
|
||||
});
|
||||
|
||||
it("should return 'all' for resource with manage permission", () => {
|
||||
const permissions = ["eventType.manage"];
|
||||
|
||||
expect(getResourcePermissionLevel("eventType", permissions)).toBe("all");
|
||||
});
|
||||
|
||||
it("should return 'all' for resource with manage permission even if other permissions are missing", () => {
|
||||
const permissions = ["eventType.manage", "eventType.read"]; // Has manage and read, but missing create, update, delete
|
||||
|
||||
expect(getResourcePermissionLevel("eventType", permissions)).toBe("all");
|
||||
});
|
||||
});
|
||||
});
|
||||
+5
-11
@@ -51,20 +51,14 @@ export function usePermissions(): UsePermissionsReturn {
|
||||
return "all";
|
||||
}
|
||||
|
||||
// Check if user has manage permission for this resource
|
||||
const hasManagePermission = permissions.includes(`${resource}.manage`);
|
||||
if (hasManagePermission) {
|
||||
return "all";
|
||||
}
|
||||
|
||||
// Filter out internal keys like _resource and manage when checking for individual permissions
|
||||
const crudPermissions = Object.keys(resourceConfig)
|
||||
.filter((action) => !action.startsWith("_") && action !== "manage")
|
||||
// Filter out internal keys like _resource when checking permissions
|
||||
const allResourcePerms = Object.keys(resourceConfig)
|
||||
.filter((action) => !action.startsWith("_"))
|
||||
.map((action) => `${resource}.${action}`);
|
||||
const hasAllCrudPerms = crudPermissions.every((p) => permissions.includes(p));
|
||||
const hasAllPerms = allResourcePerms.every((p) => permissions.includes(p));
|
||||
const hasReadPerm = permissions.includes(`${resource}.${CrudAction.Read}`);
|
||||
|
||||
if (hasAllCrudPerms) return "all";
|
||||
if (hasAllPerms) return "all";
|
||||
if (hasReadPerm) return "read";
|
||||
return "none";
|
||||
};
|
||||
|
||||
@@ -3336,7 +3336,6 @@
|
||||
"pbac_desc_view_roles": "View roles",
|
||||
"pbac_desc_update_roles": "Update roles",
|
||||
"pbac_desc_delete_roles": "Delete roles",
|
||||
"pbac_desc_manage_roles": "All actions on roles across organization teams",
|
||||
"pbac_desc_create_workflows": "Create and set up new workflows",
|
||||
"pbac_desc_view_workflows": "View existing workflows and their configurations",
|
||||
"pbac_desc_update_workflows": "Edit and modify workflow settings",
|
||||
@@ -3346,7 +3345,7 @@
|
||||
"pbac_desc_view_event_types": "View event types",
|
||||
"pbac_desc_update_event_types": "Update event types",
|
||||
"pbac_desc_delete_event_types": "Delete event types",
|
||||
"pbac_desc_manage_event_types": "All actions on event types across organization teams",
|
||||
"pbac_desc_manage_event_types": "All actions on event types",
|
||||
"pbac_desc_create_teams": "Create teams",
|
||||
"pbac_desc_view_team_details": "View team details",
|
||||
"pbac_desc_update_team_settings": "Update team settings",
|
||||
@@ -3354,7 +3353,7 @@
|
||||
"pbac_desc_invite_team_members": "Invite team members",
|
||||
"pbac_desc_remove_team_members": "Remove team members",
|
||||
"pbac_desc_change_team_member_role": "Change role of team members",
|
||||
"pbac_desc_manage_teams": "All actions on teams across organization teams",
|
||||
"pbac_desc_manage_teams": "All actions on teams",
|
||||
"pbac_desc_create_organization": "Create organization",
|
||||
"pbac_desc_view_organization_details": "View organization details",
|
||||
"pbac_desc_list_organization_members": "List organization members",
|
||||
@@ -3369,7 +3368,7 @@
|
||||
"pbac_desc_view_organization_bookings": "View organization bookings",
|
||||
"pbac_desc_view_booking_recordings": "View booking recordings",
|
||||
"pbac_desc_update_bookings": "Update bookings",
|
||||
"pbac_desc_manage_bookings": "All actions on bookings across organization teams",
|
||||
"pbac_desc_manage_bookings": "All actions on bookings",
|
||||
"pbac_desc_view_team_insights": "View team insights",
|
||||
"pbac_desc_manage_team_insights": "Manage team insights",
|
||||
"read_permission_auto_enabled_tooltip": "Read permission is automatically enabled when creating, updating, or deleting a resource",
|
||||
|
||||
Reference in new issue
Block a user