Personas & roles
Who uses the system and what they do. The disciplinary domain has a rich cast; the PoC
models them as an app_role enum but (tacitly) enforces almost none of the distinctions —
see the caveat at the end.
The cast (as the domain intends)
Role (app_role) | PT label | What they do in a case |
|---|---|---|
super_admin | Super Admin | Platform operator; manages all companies (cross-tenant) |
hr_admin | Admin RH | Runs the company's HR; opens cases, invites users, manages settings |
case_manager | Gestor de Processos | Day-to-day owner of a case; drives it through the phases |
instructor_internal | Instrutor Interno | Appointed to investigate — runs diligências, writes the relatório |
instructor_external | Instrutor Externo | Same, but an outside instructor (e.g. a lawyer) |
legal_reviewer | Revisor Jurídico | Reviews the Nota de Culpa / legal soundness |
decider | Decisor | Approves the final decision — the one enforced gate |
employee | Trabalhador (Arguido) | The person under investigation (portal, not login) |
witness | Testemunha | Gives evidence in a diligência |
external_counsel | Mandatário/Advogado | The employee's lawyer (portal access) |
Legacy roles from the whistleblower pivot —
company_admin, case_handler, viewer — still exist in the enum and are aliased to the
new ones. See Role model.
The separation of duties the domain wants
The roles exist to encode separation of duties, which is itself a fairness safeguard:
- the instructor investigates and proposes (proceed vs archive) but does not decide;
- the legal reviewer independently checks the accusation;
- the decider makes the final call — and is the only role the workflow actually gates on
(FINAL_REPORT→CLOSED needs
decision_approvalby adecider).
This separation is the legally meaningful part of the role model, and a rebuild should make it real.
Two audiences, two surfaces
INTERNAL (authenticated app) EXTERNAL (token portal, no login)
┌────────────────────────────┐ ┌──────────────────────────────┐
│ hr_admin, case_manager, │ invites │ employee (arguido), │
│ instructor, legal_reviewer,│──────────▶│ external_counsel │
│ decider, super_admin │ portal │ │
│ │ link │ • view visible documents │
│ • run the 8 phases │◀──────────│ • submit response + files │
│ • produce documents │ submission│ (during RESPONSE_WINDOW) │
│ • export the dossier │ │ • every action logged │
└────────────────────────────┘ └──────────────────────────────┘
The tacit caveat (important)
Despite this rich cast, the running app is effectively binary: isSuperAdmin vs
everyone-else. Nav, permissions, and destructive actions gate on one or two booleans, not on
the specific role; and the database's RLS enforces company membership, not the role matrix.
So the separation-of-duties above is aspirational in the PoC, not enforced.