mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-17 18:35:19 +02:00
fix: use correct groupedPermissions logic matching original implementation
This commit is contained in:
parent
55d204e05b
commit
5b85b1d090
1 changed files with 7 additions and 8 deletions
|
|
@ -214,15 +214,14 @@ export default function TeamManagementPage() {
|
|||
const { data: permissionsData, isLoading: permissionsLoading } = useAtomValue(permissionsAtom);
|
||||
const permissions = permissionsData?.permissions || [];
|
||||
const groupedPermissions = useMemo(() => {
|
||||
const grouped: Record<string, typeof permissions> = {};
|
||||
permissions.forEach((permission) => {
|
||||
const category = permission.permission_name.split(":")[0];
|
||||
if (!grouped[category]) {
|
||||
grouped[category] = [];
|
||||
const groups: Record<string, typeof permissions> = {};
|
||||
for (const perm of permissions) {
|
||||
if (!groups[perm.category]) {
|
||||
groups[perm.category] = [];
|
||||
}
|
||||
grouped[category].push(permission);
|
||||
});
|
||||
return grouped;
|
||||
groups[perm.category].push(perm);
|
||||
}
|
||||
return groups;
|
||||
}, [permissions]);
|
||||
|
||||
const canManageMembers = hasPermission("members:view");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue