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
@@ -3,22 +3,14 @@ import { describe, it, expect } from 'vitest'
|
||||
import { getRoleHome, ROLE_HOME, ALL_ROLES } from '@/lib/auth/roles'
|
||||
|
||||
describe('getRoleHome', () => {
|
||||
it('returns /reporter for reporter role', () => {
|
||||
expect(getRoleHome('reporter')).toBe('/reporter')
|
||||
})
|
||||
|
||||
it('returns /supervisor for supervisor role', () => {
|
||||
expect(getRoleHome('supervisor')).toBe('/supervisor')
|
||||
it('returns /ssa for ssa role', () => {
|
||||
expect(getRoleHome('ssa')).toBe('/ssa')
|
||||
})
|
||||
|
||||
it('returns /hse for hse role', () => {
|
||||
expect(getRoleHome('hse')).toBe('/hse')
|
||||
})
|
||||
|
||||
it('returns /capa-owner for capa_owner role', () => {
|
||||
expect(getRoleHome('capa_owner')).toBe('/capa-owner')
|
||||
})
|
||||
|
||||
it('returns /management for management role', () => {
|
||||
expect(getRoleHome('management')).toBe('/management')
|
||||
})
|
||||
@@ -27,11 +19,11 @@ describe('getRoleHome', () => {
|
||||
expect(getRoleHome('admin')).toBe('/admin')
|
||||
})
|
||||
|
||||
it('ROLE_HOME covers exactly 6 roles', () => {
|
||||
expect(Object.keys(ROLE_HOME)).toHaveLength(6)
|
||||
it('ROLE_HOME covers exactly 4 roles', () => {
|
||||
expect(Object.keys(ROLE_HOME)).toHaveLength(4)
|
||||
})
|
||||
|
||||
it('ALL_ROLES lists exactly 6 roles', () => {
|
||||
expect(ALL_ROLES).toHaveLength(6)
|
||||
it('ALL_ROLES lists exactly 4 roles', () => {
|
||||
expect(ALL_ROLES).toHaveLength(4)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user