VinylVibes uses a simple four-role access model. Roles are assigned per user in the backend and surfaced to the frontend via the JWT payload. The frontend reads role flags fromDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/akibanks/tienda_musica_web/llms.txt
Use this file to discover all available pages before exploring further.
localStorage after login to conditionally render UI elements — showing or hiding the admin panel link in the nav, disabling action controls for demo users, and preventing admins from removing their own privileges.
Role Overview
| Role | Admin Panel Access | Can Make Changes | Description |
|---|---|---|---|
cliente | No | — | Standard customer account |
vendedor | No | — | Seller account (reserved for future use) |
admin | Yes | Yes | Full admin access, can manage users and sales |
demo | Yes (read-only) | No | Demo account with read-only admin view |
How Roles Are Stored
After a successful login,login.js stores two boolean flags in localStorage derived from the server’s response payload:
esAdmin and esDemo can be true simultaneously for a given user account, though in practice the demo account uses esDemo: true with esAdmin: false. The nav in index.html shows the Admin button whenever either flag is 'true'.
Admin Access Check
admin.js performs an access check on every page load, before any data is fetched. If the user has no valid token, or if neither esAdmin nor esDemo is set to 'true', they are redirected away from the admin panel immediately:
Demo Mode Behavior
WhenesDemo is true and esAdmin is false, the admin panel enters read-only mode. The _esDemo flag is set accordingly:
- A read-only banner is inserted directly below the admin header, styled with the amber accent color.
- Role dropdowns in the users table are rendered with the
disabledattribute and reduced opacity (0.4). - Delete buttons in the users table are rendered with the
disabledattribute and reduced opacity (0.4). - Sale status dropdowns in the sales table are rendered with the
disabledattribute. - The demo user cannot change any user’s role or delete any user record.
The demo account credentials are
admin_chocolate / chocolate. This account has esDemo: true and read-only admin panel access.Changing a User’s Role
Admin users can change any other user’s role directly from the users table in the admin panel. The frontend enforces one additional guard: an admin cannot remove their ownadmin role. Before sending the role-change request to the backend, admin.js parses the currently authenticated user’s ID from the stored JWT and compares it to the target user’s ID:
admin, the change is blocked client-side and the select reverts to its previous value by re-fetching the user list.