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
@@ -69,7 +69,7 @@ export async function POST(request: NextRequest) {
|
||||
name: body.name ?? '',
|
||||
email,
|
||||
phone: (body.phone ?? '').trim() || null,
|
||||
role: (body.role as typeof users.$inferInsert['role']) ?? 'reporter',
|
||||
role: (body.role as typeof users.$inferInsert['role']) ?? 'ssa',
|
||||
siteId: body.site_id ?? null,
|
||||
department: body.department ?? null,
|
||||
passwordHash,
|
||||
@@ -78,7 +78,7 @@ export async function POST(request: NextRequest) {
|
||||
if (!created) throw new Error('User creation failed')
|
||||
createdId = created.id
|
||||
await writeAuditLog(tx, 'users', created.id, 'created', {
|
||||
email, role: body.role ?? 'reporter', site_id: body.site_id ?? null,
|
||||
email, role: body.role ?? 'ssa', site_id: body.site_id ?? null,
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user