fix(c5,arch-021): system dashboard nav entry only for system admins

This commit is contained in:
Agent Zero
2026-08-23 22:31:04 +02:00
parent 067fc132cb
commit 9e84c400ed
+14 -10
View File
@@ -79,16 +79,20 @@ export function Sidebar() {
}; };
const allMenuItems = useMemo(() => { const allMenuItems = useMemo(() => {
const staticItems = singleItems.map(item => ({ const staticItems = singleItems
path: item.to, // Backend enforces require_admin on system dashboard routes — hide the
labelKey: item.labelKey, // nav entry from non-admin users instead of showing a dead link.
label: item.labelKey, .filter(item => item.to !== '/system-dashboard' || user?.is_system_admin)
icon: item.icon, .map(item => ({
order: item.order, path: item.to,
group: undefined as string | undefined, labelKey: item.labelKey,
isStatic: true as const, label: item.labelKey,
permission: item.to === '/dashboard' ? 'dashboard:read' : item.to === '/contacts' ? 'contacts:read' : undefined, icon: item.icon,
})); order: item.order,
group: undefined as string | undefined,
isStatic: true as const,
permission: item.to === '/dashboard' ? 'dashboard:read' : item.to === '/contacts' ? 'contacts:read' : undefined,
}));
const pluginItems = (manifests || []) const pluginItems = (manifests || [])
.flatMap((m) => (Array.isArray(m.menu_items) ? m.menu_items : [])) .flatMap((m) => (Array.isArray(m.menu_items) ? m.menu_items : []))