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
@@ -2,7 +2,7 @@
|
||||
|
||||
import { useState } from 'react'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { ALL_ROLES, type UserRole } from '@/lib/auth/roles'
|
||||
import { ALL_ROLES, ROLE_LABELS, type UserRole } from '@/lib/auth/roles'
|
||||
import { Modal } from '@/components/ui/modal'
|
||||
import { INPUT_CLASS as inp } from '@/components/ui/field'
|
||||
|
||||
@@ -23,7 +23,7 @@ interface Props {
|
||||
sites: SiteOption[]
|
||||
}
|
||||
|
||||
const EMPTY = { email: '', name: '', phone: '', role: 'reporter' as UserRole, site_id: '', password: '' }
|
||||
const EMPTY = { email: '', name: '', phone: '', role: 'ssa' as UserRole, site_id: '', password: '' }
|
||||
|
||||
const lbl = 'block text-xs font-medium text-gray-600 mb-1'
|
||||
|
||||
@@ -135,7 +135,7 @@ export function UserManager({ users, sites }: Props) {
|
||||
<select value={u.role} disabled={busyId === u.id}
|
||||
onChange={e => patchUser(u.id, { role: e.target.value })}
|
||||
className="border border-divider px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-accent cursor-pointer">
|
||||
{ALL_ROLES.map(r => <option key={r} value={r}>{r.replace(/_/g, ' ')}</option>)}
|
||||
{ALL_ROLES.map(r => <option key={r} value={r}>{ROLE_LABELS[r]}</option>)}
|
||||
</select>
|
||||
</td>
|
||||
<td className="px-5 py-3">
|
||||
@@ -224,7 +224,7 @@ export function UserManager({ users, sites }: Props) {
|
||||
<select id="au-role" value={form.role}
|
||||
onChange={e => setForm(v => ({ ...v, role: e.target.value as UserRole }))}
|
||||
className={inp}>
|
||||
{ALL_ROLES.map(r => <option key={r} value={r}>{r.replace(/_/g, ' ')}</option>)}
|
||||
{ALL_ROLES.map(r => <option key={r} value={r}>{ROLE_LABELS[r]}</option>)}
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user