Skip to main content

Documentation 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.

HADOS enforces a four-tier role-based access control (RBAC) system. Every authenticated user has a single role value stored on their HabboUser document in Firestore, and the platform determines what actions and panels are visible based on that role in combination with the currently active Dado. Permissions escalate cleanly from view-only players at the bottom to a single unrestricted Global Admin at the top.

The four roles at a glance

global_admin

Full platform access. Creates and manages all Dados, assigns Dado Admins, and can inspect every user across every Dado. Not bound to any dadoId.

dado_admin

Manages a single assigned Dado. Configures tournament settings, creates and manages players, promotes Intermediarios, and can reset scores to start a new tournament.

intermediario

Operational staff within a Dado. Can add or subtract points from players and create new player entries — but cannot change tournament configuration or reset scores.

jugador

Read-only participant. Can view the leaderboard, tournament info, rules, and schedule for their Dado. Cannot modify any data.

Role capabilities in detail

global_admin — Platform owner

  • Create Dados — Opens the Global Panel and generates new Dado environments by name.
  • Assign Dado Admins — Selects any registered user from the assignment dropdown on any Dado and promotes them to dado_admin in a single atomic Firestore batch write.
  • View all users — Subscribes to the entire users collection with no dadoId filter, making every registered user across every Dado visible.
  • Switch between all Dados — The navbar “Ver Dado” dropdown shows every Dado on the platform, not just those the user participates in.
  • Access the Dado Panel — Can open the admin configuration panel for any Dado in addition to the Global Panel.
  • No dadoId restriction — The global_admin profile document has no dadoId field; access is never scoped to a single environment.

dado_admin — Tournament manager

  • Create player entries — Adds new jugador records to their Dado’s roster via the “Crear Usuario” modal.
  • Load and adjust points — Has full access to the “Cargar puntos” modal and quick +10 / +50 inline buttons on the leaderboard.
  • Configure tournament info — Sets totalPrize, qualifyingCount, rules (one per line), and schedule (one per line) from the Dado Panel.
  • Set tournament dates — Updates startDate and endDate on the Dado document.
  • Promote / demote Intermediarios — Can set any jugador in their Dado to intermediario, and revert an intermediario back to jugador.
  • Reset scores — Triggers “Crear Nuevo Torneo (Reiniciar)” to zero all player points and reset all rank counters to 1.

intermediario — Points operator

  • Load points — Accesses the “Cargar puntos” modal and quick action buttons to add or subtract points from any player in their Dado.
  • Create player entries — Can open the “Crear Usuario” modal to register new players into their Dado.
  • View leaderboard and info — Has full read access to the tournament leaderboard, rules, schedule, and info panels.
  • Cannot change configuration — Does not see the Dado Panel tab; cannot modify rules, schedule, prize, dates, or trigger a reset.

jugador — Player

  • View the leaderboard — Sees the full ranked list of players in their Dado with rank-change indicators (up / down / unchanged).
  • View tournament information — Can browse the Info, Reglas, and Fecha y horarios sub-tabs on the tournament panel.
  • View the staff list — Can see the Intermediarios tab showing who the Dado Admin and authorized Intermediarios are.
  • Cannot modify anything — No “Crear Usuario” or “Cargar puntos” buttons are shown. The Dado Panel and Global Panel tabs are hidden.

Permissions comparison table

Actionglobal_admindado_adminintermediariojugador
Create a Dado
Assign a Dado Admin
View all Dados
View all users (all Dados)
Configure tournament settings
Reset scores / start new tournament
Create player entries
Add / subtract points
Promote / demote Intermediarios
View leaderboard
View rules and schedule

How role is stored in Firestore

The role field lives directly on each HabboUser document in the users Firestore collection:
interface HabboUser {
  id: string;
  username: string;
  email: string;
  role: 'global_admin' | 'dado_admin' | 'intermediario' | 'jugador';
  dadoId?: string;
  // ...other fields
}
Because Firestore listeners keep the UI in sync in real time, a role change made by a Dado Admin (e.g. promoting a player to intermediario) takes effect in the target user’s session within seconds — no logout required.

How getActiveRole() works

The platform resolves the effective role for the current session through the getActiveRole() function. This matters because a Global Admin navigating into a Dado should still retain full admin privileges:
const getActiveRole = () => {
  if (!userProfile) return 'jugador';

  // Global Admin always wins, regardless of active Dado
  if (userProfile.role === 'global_admin') return 'global_admin';

  // If the active Dado's adminId matches the current user, they are the Dado Admin
  if (activeDado?.adminId === currentUser?.uid) return 'dado_admin';

  // Otherwise, look up the user's participation record for this specific Dado
  const participation = myParticipations.find(p => p.dadoId === activeDado?.id);
  if (participation) return participation.role;

  // Default fallback
  return 'jugador';
};
The function checks, in order:
  1. Global Admin override — If the profile role is global_admin, that role applies everywhere with no further checks.
  2. Dado ownership — If the current user’s UID matches activeDado.adminId, the effective role is dado_admin for that Dado.
  3. Participation record — The platform queries all users documents sharing the same username to find the correct participation entry (with its role and dadoId) for the active Dado.
  4. Default — If no participation record is found, the user is treated as a jugador.
Only the account registered with the email vasquezrivero92@gmail.com automatically recovers to global_admin when its Firestore profile document is missing or recreated. All other accounts that lose their profile document are recreated as jugador with no dadoId. If a Dado Admin’s profile is accidentally deleted, a Global Admin must manually reassign them via the Global Panel.

Build docs developers (and LLMs) love