Overview
OPS Workspace uses a role-based access control (RBAC) system to manage permissions. Each user is assigned a role that determines which applications they can access and which features are available to them.Role Hierarchy
There are three roles in the system, each with different permission levels:Supervisor
Highest privilegesFull access to all features including user management
Analista
Standard accessAccess to cashout operations and Operapedia
Chats
Limited accessAccess only to Operapedia for customer support
Permission Matrix
Application Access
| Application | Supervisor | Analista | Chats |
|---|---|---|---|
| Cashouts | ✅ | ✅ | ❌ |
| Operapedia | ✅ | ✅ | ✅ |
Cashouts Features
| Feature | Supervisor | Analista | Chats |
|---|---|---|---|
| Submit cashouts | ✅ | ✅ | ❌ |
| Review cashouts | ✅ | ✅ | ❌ |
| View cashout rules | ✅ | ✅ | ❌ |
| Edit cashout rules | ✅ | ❌ | ❌ |
| Create companies | ✅ | ❌ | ❌ |
| View leaderboard | ✅ | ✅ | ❌ |
| View statistics | ✅ | ✅ | ❌ |
| Manage team | ✅ | ❌ | ❌ |
| Create users | ✅ | ❌ | ❌ |
| Delete users | ✅ | ❌ | ❌ |
| Change passwords | ✅ | ❌ | ❌ |
The “Manage Team” button is automatically hidden from analysts and chat agents based on their role.
How Permissions Work
Authentication Flow
Role-Based UI Restrictions
The system enforces permissions at the UI level by conditionally rendering elements based on the user’s role:Application Visibility
At the hub level, applications are hidden based on role:Role Indicators
Visual Badge System
Each role has a distinct color scheme for easy identification:Supervisor Badge
SUPERVISOR
Analista Badge
ANALISTA
Chats Badge
CHATS
Server-Side Authorization
JWT Token Validation
All API requests include the JWT token in the Authorization header:Protected Endpoints
Certain endpoints require specific roles:| Endpoint | Required Role | Purpose |
|---|---|---|
POST /api/users | supervisor | Create new user |
DELETE /api/users/:id | supervisor | Delete user |
PUT /api/users/:id/password | supervisor | Change user password |
PUT /api/rules/:id | supervisor | Edit cashout rules |
POST /api/rules | supervisor | Create new company |
Auto-Authentication Features
Operator Name Lock
When submitting cashouts, the operator name field is automatically populated and locked to prevent impersonation:Supervisor Attribution
When reviewing cashouts, the supervisor’s name is automatically attached:Session Management
Automatic Logout Scenarios
- Token Expiration: JWT tokens expire after a set period
- Invalid Token: Tampered or corrupted tokens trigger logout
- Permission Denied: Accessing restricted resources logs out the user
- Manual Logout: User clicks “Cerrar Sesión” button
Logout Process
All logout scenarios redirect users back to the login screen at the OPS Workspace hub.
Permission Code Examples
Role-Based Feature Toggle
Role-Based Button Rendering
Admin Protection
Security Best Practices
Never trust client-side permissions
Never trust client-side permissions
Always validate permissions on the server. Client-side restrictions are for UX only and can be bypassed by malicious users.
Use JWT tokens properly
Use JWT tokens properly
- Never expose the JWT secret
- Set appropriate expiration times
- Validate tokens on every request
- Include user role in the token payload
Implement automatic session termination
Implement automatic session termination
Log out users immediately when:
- Token expires
- Token is invalid
- User accesses restricted resources
- Multiple failed authorization attempts
Prevent role escalation
Prevent role escalation
- Users cannot change their own role
- Only supervisors can assign roles
- Admin user cannot be deleted or demoted
Troubleshooting Permissions
User sees features they shouldn't have access to
User sees features they shouldn't have access to
- Check the user’s role in the database
- Verify the JWT token contains the correct role
- Clear localStorage and re-login
- Check for role assignment errors during user creation
User gets 401/403 errors
User gets 401/403 errors
- Verify the user has a valid token in localStorage
- Check if the token has expired
- Confirm the user’s role has permission for the endpoint
- Check server logs for authorization failures
Manage Team button not showing for supervisor
Manage Team button not showing for supervisor
Related Resources
Team Management
Learn how to create and manage user accounts
Authentication
Understand the login and token system