diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx index 158cab1..3c6c95f 100644 --- a/frontend/src/components/Sidebar.tsx +++ b/frontend/src/components/Sidebar.tsx @@ -16,6 +16,7 @@ import { Crosshair, Zap, Grid3X3, + List, Gauge, ShieldCheck, GitCompareArrows, @@ -37,8 +38,16 @@ interface NavItem { const mainLinks: NavItem[] = [ { to: "/dashboard", label: "Dashboard", icon: LayoutDashboard }, { to: "/executive-dashboard", label: "Executive Dashboard", icon: Gauge, roles: ["admin", "red_lead", "blue_lead", "viewer"] }, - { to: "/matrix", label: "ATT&CK Matrix", icon: Grid3X3 }, - { to: "/techniques/review-queue", label: "Review Queue", icon: ClipboardCheck, roles: ["admin", "red_lead", "blue_lead"] }, + { + to: "/matrix", + label: "ATT&CK", + icon: Grid3X3, + children: [ + { to: "/techniques", label: "Techniques", icon: List }, + { to: "/matrix", label: "Coverage Matrix", icon: Grid3X3 }, + { to: "/techniques/review-queue", label: "Review Queue", icon: ClipboardCheck, roles: ["admin", "red_lead", "blue_lead"] }, + ], + }, { to: "/tests", label: "Tests", @@ -66,8 +75,18 @@ const systemLinks: NavItem[] = [ function SidebarLink({ item, badge }: { item: NavItem; badge?: number }) { const [expanded, setExpanded] = useState(false); + const { user } = useAuth(); + const role = user?.role ?? ""; + const isAdmin = role === "admin"; + + const childCanSee = (child: NavItem) => { + if (!child.roles) return true; + if (isAdmin) return true; + return child.roles.includes(role); + }; if (item.children) { + const visibleChildren = item.children.filter(childCanSee); return (
{expanded && (
- {item.children.map((child) => ( + {visibleChildren.map((child) => ( ))}