feat(auth): merge reporter, supervisor, capa_owner into ssa role
Add Site Safety Assistant (ssa) role replacing reporter, supervisor and capa_owner. Portals move under /ssa (overview, my-reports, incidents, capas). Update RLS, schema, API role checks, notification recipients, nav and tests. Add db/ops/2026-11-06-merge-roles-into-ssa.sql (not yet applied; needs owner go-ahead and a pg_dump first). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
701fefd286
commit
813395700f
@@ -16,14 +16,13 @@ export interface NavItem {
|
||||
}
|
||||
|
||||
const NAV_ITEMS: Record<string, NavItem[]> = {
|
||||
reporter: [
|
||||
{ label: 'My Reports', href: '/reporter', icon: ClipboardList },
|
||||
ssa: [
|
||||
{ label: 'Overview', href: '/ssa', icon: AlignLeft },
|
||||
{ label: 'My Reports', href: '/ssa/my-reports', icon: ClipboardList },
|
||||
{ label: 'Site Incidents', href: '/ssa/incidents', icon: ClipboardList },
|
||||
{ label: 'My CAPAs', href: '/ssa/capas', icon: CircleCheck },
|
||||
{ label: 'New Incident', href: '/report', icon: Plus },
|
||||
],
|
||||
supervisor: [
|
||||
{ label: 'Overview', href: '/supervisor', icon: AlignLeft },
|
||||
{ label: 'Incidents', href: '/supervisor/incidents', icon: ClipboardList },
|
||||
],
|
||||
hse: [
|
||||
{ label: 'Dashboard', href: '/hse/dashboard', icon: LayoutDashboard },
|
||||
{ label: 'Incidents', href: '/hse/incidents', icon: ClipboardList },
|
||||
@@ -31,7 +30,6 @@ const NAV_ITEMS: Record<string, NavItem[]> = {
|
||||
{ label: 'Settings', href: '/hse/settings', icon: Settings },
|
||||
],
|
||||
management: [{ label: 'Dashboard', href: '/management', icon: LayoutDashboard }],
|
||||
capa_owner: [{ label: 'My CAPAs', href: '/capa-owner', icon: CircleCheck }],
|
||||
admin: [
|
||||
{ label: 'Admin', href: '/admin', icon: Users },
|
||||
{ label: 'Dashboard', href: '/hse/dashboard', icon: LayoutDashboard },
|
||||
@@ -42,10 +40,10 @@ const NAV_ITEMS: Record<string, NavItem[]> = {
|
||||
],
|
||||
}
|
||||
|
||||
const EXACT_ROOTS = ['/reporter', '/supervisor', '/management', '/capa-owner', '/admin', '/report', '/account']
|
||||
const EXACT_ROOTS = ['/ssa', '/management', '/admin', '/report', '/account']
|
||||
|
||||
export function navItemsFor(role: string): NavItem[] {
|
||||
return NAV_ITEMS[role] ?? NAV_ITEMS.reporter
|
||||
return NAV_ITEMS[role] ?? NAV_ITEMS.ssa
|
||||
}
|
||||
|
||||
export function isActivePath(href: string, pathname: string): boolean {
|
||||
@@ -54,6 +52,6 @@ export function isActivePath(href: string, pathname: string): boolean {
|
||||
|
||||
export function searchHrefFor(role: string): string | null {
|
||||
if (role === 'hse' || role === 'admin') return '/hse/incidents'
|
||||
if (role === 'supervisor') return '/supervisor/incidents'
|
||||
if (role === 'ssa') return '/ssa/incidents'
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user