HADOS enforces a four-tier role-based access control (RBAC) model. Every user has a stored role written to theirDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/VasquezRivero92/HabboCafe/llms.txt
Use this file to discover all available pages before exploring further.
HabboUser.role field in Firestore, and an effective role computed at runtime by getActiveRole() for the currently selected Dado. These two values can differ: for example, a jugador whose stored role is jugador becomes effectively a dado_admin for a Dado where Dado.adminId matches their Firebase Auth UID.
Roles overview
global_admin
The highest privilege tier. Manages the entire HADOS instance — creates Dados, assigns Dado Admins, and can view all users across every Dado. Only one or a handful of trusted operators should hold this role.
dado_admin
Owner of a specific Dado. Configures tournament info, rules, schedule, prize pool, and qualifying count. Can reset tournament scores, promote players to
intermediario, and demote them back to jugador.intermediario
Tournament staff within a Dado. Can add new players manually and modify point totals, but cannot change any configuration or role assignments.
jugador
A regular tournament participant. Read-only access to the leaderboard and tournament info. Cannot modify any data.
Permissions matrix
| Action | global_admin | dado_admin | intermediario | jugador |
|---|---|---|---|---|
| View leaderboard | ✓ | ✓ | ✓ | ✓ |
| View tournament info / rules / schedule | ✓ | ✓ | ✓ | ✓ |
| Add or subtract points | ✓ | ✓ | ✓ | ✗ |
| Create player (manual add) | ✓ | ✓ | ✓ | ✗ |
Promote / demote roles (jugador ↔ intermediario) | ✓ | ✓ | ✗ | ✗ |
| Configure tournament info, rules, schedule, prize | ✗ | ✓ | ✗ | ✗ |
| Reset tournament scores (start new tournament) | ✗ | ✓ | ✗ | ✗ |
| Create a new Dado | ✓ | ✗ | ✗ | ✗ |
| Assign a Dado Admin | ✓ | ✗ | ✗ | ✗ |
| View all users across all Dados | ✓ | ✗ | ✗ | ✗ |
Role storage
Therole field is stored directly on the HabboUser Firestore document:
/users/{userId} → field role
This field is the source of truth for persistent, cross-session role identity. However, for any UI permission check within a session, the application always calls getActiveRole() rather than reading userProfile.role directly, because Dado Admin status is derived from Dado.adminId, not from the stored role field alone.
getActiveRole() — effective role resolution
getActiveRole() computes the caller’s effective role for the currently active Dado. It runs entirely on the client from data already held in React state (no extra Firestore reads):
Resolution order
Check for loaded profile
If
userProfile is null (auth still loading), return 'jugador' as a safe default.Check for global_admin stored role
If
userProfile.role === 'global_admin', return 'global_admin' immediately. This check cannot be overridden by any Dado-level state.Check Dado.adminId
If
activeDado.adminId equals currentUser.uid, return 'dado_admin'. This allows a user whose stored role is still 'jugador' to act as Dado Admin the moment the batch write sets Dado.adminId.Check participation records
Query
myParticipations for a record where dadoId matches the active Dado. If found, return that record’s role field ('intermediario' or 'jugador').canModifyPoints() — point-editing gate
All point-modification UI (quick +10 / +50 / -10 / -50 buttons, Cargar Puntos modal, and Crear Usuario modal) is gated behind this helper:
true for global_admin, dado_admin, and intermediario. Returns false for jugador.
Role elevation flows
Global Admin assigns a Dado Admin
Only aglobal_admin can elevate a user to dado_admin. The operation is a batch write that atomically updates both the Dado document and the target HabboUser document:
Dado Admin and Global Admin promote/demote intermediarios
Bothdado_admin and global_admin can toggle any jugador in the active Dado to intermediario (and back). The Intermediarios tab and the Dado Admin panel both gate this action behind getActiveRole() === 'global_admin' || getActiveRole() === 'dado_admin'. The write itself is a simple updateDoc:
Special accounts
Auto-recovery for
vasquezrivero92@gmail.comIf a user signs in with vasquezrivero92@gmail.com and their Firestore profile document does not exist (e.g. after a database wipe or accidental deletion), HADOS automatically synthesises a recovery profile with role: 'global_admin' and writes it to /users/{uid}. No other email address triggers this recovery path — all other missing profiles receive role: 'jugador'.Global Admin self-registration
A user can self-register as a Global Admin during the sign-up flow by checking Registrar como Administrador Global and supplying the correct secret code (GLOBAL2026). If the code is wrong, the registration is rejected client-side before any Firebase Auth call is made.
Role colours in the UI
The navbar renders the effective role with a colour-coded label to help staff quickly identify their access level at a glance:| Role | Colour |
|---|---|
global_admin | Red (#ef4444) |
dado_admin | Gold (#ffd700) |
intermediario | Purple (#9d4edd) |
jugador | Grey (#8c8c9e) |