Skip to main content
TMT uses CASL (@casl/ability and @casl/react) to enforce role-based access control throughout the application. Every protected route and action is guarded by a permission check at render time.

How permissions work

When a user logs in, their account_type field is read from their Firestore profile. The defineAbilitiesFor function in src/guards/contexts/DefineAbilities.js builds a CASL Ability object based on that account type. This ability instance is provided to the entire React tree via the AbilityContext. Each protected route is wrapped in a PermissionGuard component:
<PermissionGuard action="view" subject="ViewContracts">
  <ContractsTable />
</PermissionGuard>
If the current user’s ability does not satisfy can(action, subject), they are redirected to /auth/permissions, which displays an access-denied page.

Built-in roles

TMT ships with five predefined roles:
RoleDescription
AdministradorFull access to all features and settings. Uses CASL’s can('manage', 'all') — no restrictions.
CoordinadorManages events, contracts, offices, clients, and collaborators. Can view client payouts (ViewClientPayouts) but cannot access the main payout management (ViewPayouts) or marketing campaigns. Cannot create or edit staff accounts.
ContadorRead-only access to clients, contracts, events, and financial data. Can view ticket search and client payouts. Cannot create events, contracts, manage users, view campaigns, or access payout management.
SoporteCan view clients, collaborators, events, event configuration, and individual ticket details (ViewTicketsDetail). Cannot view the ticket list (ViewTickets), create or modify most data, access payouts, or view campaigns.
Creador de Sala de EventosCan create and manage event venues only. Cannot access most other features.
The Administrador role bypasses all permission checks. Assign this role only to users who need unrestricted platform access.

Permission subjects

The table below lists every permission subject in the system. The action for all route guards is "view".

User management

SubjectDescription
ViewStaffView staff user list
ViewStaffDetailView staff user detail
ViewStaffCreateAccess the create staff form
ViewStaffEditAccess the edit staff form
ViewClientsView client list
ViewClientsDetailView client detail
ViewClientsCreateAccess the create client form
ViewClientsEditAccess the edit client form
ViewCollaboratorsView collaborator list
ViewCollaboratorsDetailView collaborator detail
ViewCollaboratorsCreateAccess the create collaborator form
ViewCollaboratorsEditAccess the edit collaborator form
ViewCollaboratorsEventsView events assigned to a collaborator
ViewClientCollaboratorsView collaborators linked to a client
ViewCustomersView customer (end-user) list
ViewCustomersDetailView customer detail
ViewCustomerOrdersView customer order history
ViewCustomerTicketsView tickets owned by a customer

Events and venues

SubjectDescription
ViewEventsView events list
ViewClientEventsView events scoped to a client
ViewEventsCreateAccess the create event form
ViewEventsEditAccess the edit event form
ViewEventsDetailView event detail
ViewEventsConfigAccess event configuration
ViewEventsConfigZoneConfigure seating zones for an event
ViewEventsConfigSplitConfigure revenue splits for an event
ViewEventsCredentialsView event credentials list
ViewEventsCredentialsCreateCreate new event credentials
ViewEventsCredentialsCreateDetailView credential detail
ViewEventsNotificationsView event notifications
ViewEventsNotificationsCreateCreate event notifications
ViewEventVenueView venue list
ViewEventVenueCreateCreate a new venue
ViewEventVenueEditEdit a venue
ViewEventVenueDetailView venue detail
ViewEventVenueEventsView events at a venue

Tickets

SubjectDescription
ViewTicketsView ticket list
ViewTicketsDetailView ticket detail
TicketSearchViewSearch for tickets
QueryTicketDisplayDisplay query ticket results

Contracts

SubjectDescription
ViewContractsView contracts list
ViewContractsCreateCreate a new contract
ViewContractsDetailView contract detail
ViewAddendumView addendum list
ViewAddendumDetailView addendum detail

Offices (Taquillas)

SubjectDescription
ViewOfficeListView office list
ViewOfficeDetailsView office detail
ViewCreateOfficeCreate a new office
ViewEditOfficeEdit an office
ViewOfficeEventListView events at an office
ViewOfficeTransactionListView transactions at an office
ViewOfficesSalesListView the cross-office sales summary

Financial

SubjectDescription
ViewPayoutsView payout list
ViewPayoutView a single payout detail
CreatePayoutsCreate a payout
EditPayoutsEdit a payout
ViewClientPayoutsView payouts for a specific client
CreateClientPayoutsCreate a client payout

Platform

SubjectDescription
ViewPlatformSettingsAccess platform settings

Configuring permissions

Permissions are defined in code in src/guards/contexts/DefineAbilities.js. To modify what a role can or cannot do, update the commonPermissions object for that role and redeploy the application. There is no UI for editing role permissions.
The defineAbilitiesFor function accepts a user object and returns a CASL Ability instance. Administrators receive can('manage', 'all'), while other roles receive explicit can and cannot rule sets:
// Example: adding a permission to the Coordinador role
// In src/guards/contexts/DefineAbilities.js
'Coordinador': {
  can: [
    // existing permissions...
    ['view', 'ViewNewFeature'], // add here
  ],
  cannot: [
    // existing restrictions...
  ]
}
After updating abilities, users will need to log out and back in for the new ability instance to be initialized.

Build docs developers (and LLMs) love