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:
Weei Han
2026-11-06 21:34:10 +08:00
co-authored by Claude Sonnet 5.5
parent 701fefd286
commit 813395700f
31 changed files with 123 additions and 96 deletions
+11 -9
View File
@@ -1,26 +1,28 @@
// lib/auth/roles.ts
// 'ssa' = Site Safety Assistant. Replaces the former reporter, supervisor and capa_owner roles.
export type UserRole =
| 'reporter'
| 'supervisor'
| 'ssa'
| 'hse'
| 'capa_owner'
| 'management'
| 'admin'
export const ALL_ROLES: UserRole[] = [
'reporter',
'supervisor',
'ssa',
'hse',
'capa_owner',
'management',
'admin',
]
export const ROLE_LABELS: Record<UserRole, string> = {
ssa: 'Site Safety Assistant (SSA)',
hse: 'HSE',
management: 'Management',
admin: 'Admin',
}
export const ROLE_HOME: Record<UserRole, string> = {
reporter: '/reporter',
supervisor: '/supervisor',
ssa: '/ssa',
hse: '/hse',
capa_owner: '/capa-owner',
management: '/management',
admin: '/admin',
}