Skip to main content
TMT enforces access control using CASL, specifically the @casl/ability and @casl/react packages. Every protected route is wrapped in a PermissionGuard that checks whether the current user’s computed ability allows the required action on the required subject. If not, the user is redirected to /auth/permissions.

User types

TMT has four main categories of platform users:
User typeDescription
StaffInternal team members who administer the platform. They are stored in the u_staff Firestore collection and are the only users who can log in to the admin panel.
ClientsOrganizations or individuals who contract TMT to manage their events. Clients are managed at /usuarios-clients.
CollaboratorsExternal partners or helpers assigned to specific events. Managed at /usuarios-collaborators.
CustomersEnd users who purchase tickets. Their orders and tickets can be viewed under /usuarios-customers.
Only Staff accounts can authenticate with the admin panel. Clients, Collaborators, and Customers are managed entities within the system — they do not log in here.

Staff roles

Within the Staff user type, each account is assigned an account_type field in Firestore. The defineAbilitiesFor function in src/guards/contexts/DefineAbilities.js reads this field and builds a CASL Ability object for the session. The five defined staff roles are:
RoleDescription
AdministradorFull access — can('manage', 'all'). No restrictions.
CoordinadorBroad operational access. Can manage clients, collaborators, events, tickets, credentials, contracts, venues, and offices. Cannot create or edit other staff members, change event/ticket statuses, or access payout management (ViewPayouts) and campaigns. Can view client payouts (ViewClientPayouts).
ContadorRead-only financial focus. Can view clients, contracts, events, event details, and payout information. Cannot create users, events, tickets, or credentials.
SoporteRead-only support access. Can view events, event configuration, individual ticket details (ViewTicketsDetail), and venue details. Cannot view the ticket list (ViewTickets), cannot create or edit anything, and cannot access contracts, staff lists, campaigns, or payouts.
Creador de Sala de EventosNarrowly scoped to venue management. Can create and edit event venues. Has no access to events, tickets, users, contracts, or financial features.

How CASL is applied

At login, defineAbilitiesFor(user) is called with the authenticated user’s profile. The resulting Ability instance is placed on the AbilityContext (defined in src/guards/contexts/AbilityContext.js) using React context. The PermissionGuard component reads from this context:
// src/guards/authGuard/PermissionGuard.js
const PermissionGuard = ({ children, action, subject }) => {
    const ability = React.useContext(AbilityContext);
    const navigate = useNavigate();

    React.useEffect(() => {
        if (!ability.can(action, subject)) {
            navigate("/auth/permissions", { replace: true });
        }
    }, [navigate]);

    return children;
};
Every route that uses PermissionGuard declares an action (always "view" for route-level guards) and a subject string. If the ability check fails, the user is redirected immediately. In view templates, fine-grained UI elements use the <Can> component from @casl/react:
<Can I="change" a="eventsStatus" ability={ability}>
  <StatusSelect eventData={eventData} />
</Can>
This means a status selector only renders for roles that have the change action on eventsStatus — namely Administrador only.

Permission subjects reference

The table below lists every permission subject used in Router.js along with the route it protects.
SubjectRouteDescription
ViewStaff/usuarios-staffView staff list
ViewStaffDetail/usuarios-detalle-staffView individual staff profile
ViewStaffCreate/usuarios-staff-crearCreate a new staff member
ViewStaffEdit/usuarios-staff-editarEdit a staff member
ViewClients/usuarios-clientsView clients list
ViewClientsDetail/usuarios-detalle-clienteView individual client profile
ViewClientsCreate/usuarios-clientes-crearCreate a new client
ViewClientsEdit/usuarios-clientes-editarEdit a client
ViewCollaborators/usuarios-collaboratorsView collaborators list
ViewCollaboratorsDetail/usuarios-detalle-colaboradorView collaborator profile
ViewCollaboratorsCreate/usuarios-collab-crearCreate a new collaborator
ViewCollaboratorsEdit/usuarios-collab-editarEdit a collaborator
ViewCollaboratorsEvents/eventos-colaboradorView collaborator’s assigned events
ViewClientCollaborators/cliente-collaboratorsView collaborators under a specific client
ViewCustomers/usuarios-customersView customers list
ViewCustomersDetail/usuarios-detalle-customersView customer profile
ViewCustomerTickets/lista-tickets-customerView a customer’s tickets
ViewCustomerOrders/lista-ordenes-customerView a customer’s orders
ViewEventVenue/salones-eventosView event venues list
ViewEventVenueDetail/salones-eventos-detalleView venue detail
ViewEventVenueCreate/salones-eventos-crearCreate a new venue
ViewEventVenueEdit/salones-eventos-editarEdit a venue
ViewEventVenueEvents/salones-eventos-eventosView events linked to a venue
ViewEvents/eventosView events list
ViewClientEvents/cliente-eventosView events scoped to a client
ViewEventsCreate/eventos-crearCreate a new event
ViewEventsEdit/eventos-editarEdit an event
ViewEventsConfig/eventos-configConfigure event zones and adjustments
ViewEventsConfigZone/eventos-config-zonasConfigure individual zone details
ViewEventsConfigSplit/eventos-config-splitConfigure revenue split
ViewEventsDetail/evento-detallesView event detail page
ViewEventsCredentials/eventos-credencialesView event credentials list
ViewEventsCredentialsCreate/eventos-credenciales-crearCreate new credential
ViewEventsCredentialsCreateDetail/eventos-credenciales-detallesView credential detail
ViewEventsNotifications/eventos-notificacionesView event notifications list
ViewEventsNotificationsCreate/eventos-notificaciones-crearCreate a new notification
ViewTickets/ticketsView ticket list for an event
ViewTicketsDetail/tickets-detallesView individual ticket detail
TicketSearchView/buscar-ticketSearch for a ticket by identifier
QueryTicketDisplay/ticket-consultadoDisplay a queried ticket’s details
ViewContracts/contractsView contracts list
ViewContractsDetail/contract-detailsView a contract
ViewContractsCreate/create-contractsCreate a contract
ViewAddendum/create-addendumCreate an addendum
ViewAddendumDetail/addendum-detailsView an addendum
ViewPayouts/cuentas-pagoView payout accounts
CreatePayouts/cuentas-pago-crearCreate a payout account
ViewPayout/cuentas-pago-detallesView payout details
EditPayouts/cuentas-pago-editarEdit a payout account
ViewClientPayouts/payouts-clienteView payouts for a client
CreateClientPayouts/crear-payouts-clienteCreate a payout for a client
ViewPlatformSettings/platform-settingsAccess platform settings
ViewOfficeList/lista-taquillasView ticketing offices list
ViewOfficeDetails/detalles-taquillaView office details
ViewCreateOffice/crear-taquillaCreate a ticketing office
ViewEditOffice/editar-taquillaEdit a ticketing office
ViewOfficeEventList/lista-eventos-taquillaView events active in an office
ViewOfficeTransactionList/transacciones-taquillaView office transactions
ViewOfficesSalesList/lista-ventas-taquillaView sales list for an office
Routes without a PermissionGuard wrapper (such as /ordenes, /transacciones, and /conciliaciones) are accessible to any authenticated staff member regardless of role.

Build docs developers (and LLMs) love