Ordervista uses a role-based access control system to ensure every user can only reach the parts of the application relevant to their responsibilities. When a user authenticates, the backend signs a JWT that embeds the user’sDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ytabeloved/ordervista/llms.txt
Use this file to discover all available pages before exploring further.
id_rol claim. Every protected API route then validates that claim against an allowlist of permitted role IDs before processing the request. This model keeps the three user types — Administrator, Operator, and Customer — cleanly separated without requiring separate authentication systems.
Administrator
Full system access: manage users, products, categories, and view analytics reports.
Operator
Operational access: manage active orders, kitchen commands, and generate receipts.
Customer
Self-service access: browse the menu, place online orders, and track order history.
Role IDs
Each role is stored in theROLES table and referenced by the id_rol field on every user record. The numeric ID is embedded directly into the JWT payload so the middleware can authorize requests without an extra database lookup.
| Role ID | Role Name | Description |
|---|---|---|
1 | Administrator | Full access to user management, catalog, and reporting. |
2 | Operator | Access to order management, kitchen commands, and receipts. |
3 | Customer | Access to the menu, cart, order placement, and personal order history. |
How Role Enforcement Works
After theverifyToken middleware decodes the JWT and attaches the payload to req.user, the authorizeRoles(...allowedRoles) middleware checks whether req.user.id_rol is included in the list of roles permitted for that route. If the check fails, the server responds with 403 Forbidden before the route handler is ever called.
verifyToken always runs first to validate the token signature and expiry, then authorizeRoles runs to check the role claim.
Role
1 (Administrator) is the only role that can manage users, categories, and products, and the only role with access to the reports dashboard. Operators and Customers cannot reach any of these endpoints.