Skip to content

Roles and Permissions

Neemias access control is role-based (RBAC). The permission definitions are in packages/permissions/index.ts — the single source of truth shared between frontend and backend.

Built-in Roles

RolePermissionsDescription
ADMIN17Full access: attendance, reports, students, users, classes, núcleos, settings, import/export
CHAMADOR2Mark attendance and search students
RELATORIOS2View reports and search students
CADASTRO6Register students, manage classes, núcleos, and lessons
RESPONSAVEL1View own children's attendance records
VOLUNTARIO3Mark attendance, search students, view assigned class reports
COORDENACAO_KIDS5Manage classes, núcleos, sessions, attendance, and students for assigned classes
ADMINISTRATIVO_KIDS5Manage students, sessions, attendance, and reports for assigned classes

Note: The ADMIN role always has all system permissions, regardless of future changes to the list.

Multi-role support (v0.56.0+): Users can hold multiple roles simultaneously via the user_roles join table. AuthPrincipal.roles[] contains all assigned roles; primaryRole determines the display badge. requireRole() uses roles.some() for any() match. See ADR-0022.

v0.55.1: VOLUNTEER role removed. VOLUNTARIO_KIDS renamed to VOLUNTARIO.

Complete Permission List

#PermissionDescriptionADMINCHAMADORRELATORIOSCADASTRO
1attendanceMark student presence/absence
2reportsAccess attendance reports
3students.addCreate new students
4students.editEdit student data
5students.deleteDelete students (soft-delete with justification)
6students.searchSearch and list students
7users.viewView user list
8users.createCreate new users
9users.editEdit user data
10users.deactivateDeactivate users (soft-delete)
11users.resetPasswordReset user passwords
12settingsAccess system settings
13import-exportImport and export data
14sessions.addCreate class sessions/occurrences
15sessions.editEdit class sessions/occurrences
16nuclei.manageCreate, edit, and delete núcleos
17classes.manageCreate, edit, and delete classes

Dynamic Roles (v0.26.0+)

Starting from version 0.26.0, the system supports dynamic roles: the administrator can create custom roles with arbitrary permission sets, in addition to the four built-in roles. The permissions architecture was designed so that new roles are added with a single entry in the PERMISSIONS map, and the UserRole type is automatically derived — with no duplication of definitions.

Route Protection

On the frontend, the PermissionGuard component wraps each route and checks whether the logged-in user has the required permission. On the backend, the authentication middleware (workers/src/middleware/auth.ts) applies role verification (role guard) on every API route.


Sources: PRD §7 · packages/permissions/index.ts

Distributed under MIT License.