mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
chnages
This commit is contained in:
@@ -643,18 +643,6 @@ const filterSidebarByPermission = (
|
||||
return true;
|
||||
});
|
||||
|
||||
// Recursive: a group's own permission gates the whole subtree, leaves are
|
||||
// checked individually, and a group with no surviving children disappears.
|
||||
const filterItems = (items: SidebarItem[]): SidebarItem[] =>
|
||||
items.flatMap((item) => {
|
||||
if (item.children?.length) {
|
||||
if (item.permission && !permissionAllowed(item)) return [];
|
||||
const children = filterItems(item.children);
|
||||
return children.length ? [{ ...item, children }] : [];
|
||||
}
|
||||
return itemAllowed(item) ? [item] : [];
|
||||
});
|
||||
|
||||
return sections
|
||||
.map((section) => ({
|
||||
...section,
|
||||
|
||||
Reference in New Issue
Block a user