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
@@ -50,7 +50,7 @@ export async function GET(
|
||||
|
||||
const role = session.role
|
||||
const isOwner = row.ownerUserId === session.sub
|
||||
const canRead = ['hse', 'admin', 'supervisor'].includes(role) || isOwner
|
||||
const canRead = ['hse', 'admin', 'ssa'].includes(role) || isOwner
|
||||
if (!canRead) return NextResponse.json({ error: 'Forbidden' }, { status: 403 })
|
||||
|
||||
const ownerField = ['hse', 'admin'].includes(role)
|
||||
|
||||
@@ -40,7 +40,7 @@ export async function GET() {
|
||||
.leftJoin(incidents, eq(capaActions.incidentId, incidents.id))
|
||||
.orderBy(asc(capaActions.dueDate))
|
||||
|
||||
if (session.role === 'supervisor' || session.role === 'worker') {
|
||||
if (session.role === 'ssa') {
|
||||
q = q.where(eq(capaActions.ownerUserId, session.sub)) as typeof q
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user