Cole’s authorization layer is built on Spatie Laravel Permission. Every user is assigned exactly one role at creation time, and that role determines which API endpoints the user can reach, which data they can read or write, and whether they are bound to a single tenant or have cross-tenant authority. All role checks are enforced at the route middleware level using theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/iamalexis689725/cole/llms.txt
Use this file to discover all available pages before exploring further.
role middleware alias registered in Kernel.php.
Spatie Laravel Permission Integration
TheUser model uses the HasRoles trait provided by Spatie, giving every user instance the standard assignRole, hasRole, getRoleNames, and can helpers:
roles table by RoleSeeder:
Role Reference
super-admin
Platform-level administrator. Has no
tenant_id. The CheckModule middleware is bypassed entirely for this role. Can create and manage tenants, assign modules, and access any module-gated endpoint across every school account.director
School principal. Belongs to one tenant. Manages the full operational data of their school: teachers, students, courses, class sections (paralelos), academic periods, and evaluation criteria.
profesor
Teacher. Belongs to one tenant. Can record and view attendance, enter grades, manage agenda items, and write anecdotario entries for the courses they are assigned to.
estudiante
Student. Belongs to one tenant. Can view their own schedule, check pending agenda tasks, and submit task deliveries (entregas). Read access is restricted to their own enrolments and grades.
padre
Parent or guardian. Belongs to one tenant. Can view the grades, attendance records, agenda entries, and anecdotario notes associated with their linked children.
Summary Table
| Role | Tenant-scoped | Manage tenants | Manage modules | Teachers & courses | Attendance & grades | Own data only |
|---|---|---|---|---|---|---|
| super-admin | ✗ | ✓ | ✓ | ✓ | ✓ | ✗ |
| director | ✓ | ✗ | ✗ | ✓ | ✓ | ✗ |
| profesor | ✓ | ✗ | ✗ | ✗ | ✓ | ✗ |
| estudiante | ✓ | ✗ | ✗ | ✗ | ✗ | ✓ |
| padre | ✓ | ✗ | ✗ | ✗ | ✗ | ✓ |
Role Details
super-admin — Platform Administrator
super-admin — Platform Administrator
The
super-admin role is intended for the platform operator, not for school staff. A super-admin’s tenant_id is null, which means:- The
BelongsToTenantglobal scope fires but compares againstnull, so tenant-scoped models must be queried withwithoutGlobalScope('tenant')to retrieve records across all tenants. - The
CheckModulemiddleware is bypassed — all module-gated endpoints are accessible.
POST /api/tenants— Create a new school accountGET /api/tenants— List all schoolsPOST /api/tenants/{tenantId}/modules— Assign a module to a schoolPATCH /api/tenants/{tenantId}/modules/{moduleId}/activate— Activate a modulePATCH /api/tenants/{tenantId}/modules/{moduleId}/deactivate— Deactivate a module
director — School Principal
director — School Principal
A director is the administrative head of a single school. They control the master data of their institution:
- Academic periods and evaluation periods
- Courses, subjects, and class sections (paralelos)
- Teacher enrolments and teacher-to-subject assignments
- Student profiles and course enrolments
- Grading criteria
profesor — Teacher
profesor — Teacher
A teacher operates within the courses they are assigned to. Their access focuses on day-to-day instructional data:
- Record and query attendance (
asistenciamodule) - Enter and update student grades (
nota,criterio) - Create and update agenda entries (
agendamodule) - Write anecdotario notes about students (
anecdotariomodule)
estudiante — Student
estudiante — Student
A student has read-only access to their own academic information:
- View their schedule and assigned courses
- View pending agenda tasks
- Submit task deliveries and upload attachments
- View their own grades and attendance record
BelongsToTenant global scope.padre — Parent / Guardian
padre — Parent / Guardian
A parent or guardian account is linked to one or more student profiles via the
PadreEstudiante pivot. A padre can:- View the grades of their linked children
- View attendance records for their linked children
- View agenda items and anecdotario notes related to their children
Assigning Roles
Roles are assigned at the point of user creation using Spatie’sassignRole method:
Using Role Middleware on Routes
Therole middleware alias maps to Spatie\Permission\Middleware\RoleMiddleware. Apply it to route groups or individual routes using a pipe-separated list of accepted roles:
403 Forbidden response from the Spatie middleware.