La Comanda uses a role-based access control system to ensure every staff member sees only the tools relevant to their responsibilities. Each user account is assigned one of four roles at creation time, and the application enforces those boundaries on every request through a centralized middleware function.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/JAQA20/LaComanda/llms.txt
Use this file to discover all available pages before exploring further.
The Four Roles
Admin
rol_id = 1Full access to every area of the application. Admins can manage users, products, categories, orders, and table layouts from the admin panel. They can also monitor active sessions and have unrestricted visibility across all workflows. Admin bypasses all role checks automatically.
Waiter (Mesero)
rol_id = 2Access to the order-taking interface at
views/index.php. Waiters select tables, add products to open orders, submit those orders to the kitchen or bar, and mark items as delivered. They can also see the current status of all tables on the floor.Kitchen (Cocina)
rol_id = 3Access to the kitchen queue at
views/cocina.php. Kitchen staff see incoming food orders in real time, update item status to en_preparacion while cooking, and mark completed items or full orders as listo or entregada when the food is ready to leave the kitchen.Barista
rol_id = 4Access to the barista queue at
views/barista.php. Baristas see only orders that contain items belonging to the cafes or bebidas categories. They mark drinks as en_preparacion while being prepared and listo once ready for the waiter to pick up.Role Assignment
Roles are assigned when a user account is created inside the admin panel. There is no self-registration flow — only an Admin can create new accounts and choose a role for each one.- Roles are stored in the
rolesdatabase table and referenced byrol_idon each user record in theusuariostable. - The Admin role (
rol_id = 1) should be reserved for trusted staff only. There is no permission sub-setting within a role — a user either has full Admin access or they do not. - Role changes take effect on the user’s next login; existing sessions retain the role that was active when they logged in.
Access Control Implementation
Role enforcement is handled by theverificarRol() function defined in middleware/roles.php. Every protected view calls this function at the top of the file, passing an array of role IDs that are allowed to access it.
The function reads $_SESSION['rol_id'] set at login and applies the following logic:
- If no session exists, the user is redirected to the login page.
- If
rol_id === 1(Admin), the check is skipped entirely — Admin always has access. - For all other roles, the function verifies the user’s role is in the
$rolesPermitidosarray. - If the role is not permitted, the user is redirected to
views/accesoRestringido.php.
verificarRol([3]), the barista view calls verificarRol([4]), and the waiter view calls verificarRol([2]). The admin panel calls verificarRol([1]), though the bypass means only the session check is ever evaluated for that view.
Default Test Accounts
The following test accounts are included with the development seed data. Replace all passwords before deploying to production.| Role | Password | |
|---|---|---|
| Admin | admin@lacomanda.com | admin123 |
| Waiter (Mesero) | mesero@lacomanda.com | mesero123 |
| Kitchen (Cocina) | cocina@lacomanda.com | cocina123 |
| Barista | barista@lacomanda.com | barista123 |