RBAC Overview
RBAC Overview
Section titled “RBAC Overview”Role-Based Access Control (RBAC) in Mantis provides granular security for all system resources.
Overview
Section titled “Overview”Key Concepts
Section titled “Key Concepts”Users are individual accounts that can authenticate to Mantis. Each user:
- Has unique email and username
- Can be assigned one or more roles
- May be scoped to a specific tenant
- Can authenticate via local credentials or external identity providers
Roles are named groups of permissions. Mantis includes system roles:
| Role | Description |
|---|---|
admin | Full system access with all permissions |
operator | Deployment and target management |
viewer | Read-only access to resources |
tenant_admin | Full access within assigned tenant |
Custom roles can be created to match your organizational needs.
Permissions
Section titled “Permissions”Permissions grant specific actions on resources. Format: resource:action
| Component | Examples |
|---|---|
| Resource | deployments, targets, actions, users |
| Action | create, read, update, delete |
Example permissions:
deployments:create- Start new deploymentstargets:read- View target informationusers:delete- Remove user accounts
Permission Model
Section titled “Permission Model”Permission Inheritance
Section titled “Permission Inheritance”Users receive permissions through their roles:
User → Roles → PermissionsIf a user has multiple roles, they receive the union of all permissions:
Authorization Flow
Section titled “Authorization Flow”Permission Checking
Section titled “Permission Checking”Every protected endpoint validates permissions:
// In handlercheck_permission(&mut conn, audit, &auth.claims, "deployments:create").await?;The check:
- Extracts
user_idfrom JWT claims - Queries database for user’s permissions via roles
- Returns success or logs denial to audit
System Roles
Section titled “System Roles”Full system access:
- All permissions across all resources
- Cannot be modified or deleted
- Typically assigned to platform administrators
Operator
Section titled “Operator”Deployment operations:
- Create, read, update actions/sequences/solutions
- Create and manage deployments
- Register and manage targets
Viewer
Section titled “Viewer”Read-only access:
- View deployments and their status
- View targets and environments
- View actions, sequences, solutions
- Cannot make any modifications
Tenant Admin
Section titled “Tenant Admin”Full access within tenant scope:
- The seed grants
tenant_adminevery permission except five system-tier ones:tenants:create- Cannot create new tenantstenants:delete- Cannot delete tenantssystem:admin- No system administrationsettings:manage- Cannot modify system settingsaudit:read- Cannot read audit logs
- Delegation is secure by default: when a
tenant_admin(or any non-system-admin) assigns roles/permissions, it may confer only permissions it itself holds or ones carried by the baselineviewer/operatorroles. Everything else — including any future system-tier permission — is refused. See Permissions → Tenant Admin Role for details. - Ideal for delegated tenant management
Multi-Tenant Context
Section titled “Multi-Tenant Context”When a user has a tenant_id:
- All queries are automatically filtered by tenant
- User can only access resources within their tenant
- Cross-tenant access returns 404 (not 403) to prevent enumeration
Best Practices
Section titled “Best Practices”Principle of Least Privilege
Section titled “Principle of Least Privilege”Assign the minimum permissions required:
Role Hierarchy Strategy
Section titled “Role Hierarchy Strategy”Create roles matching your organization:
| Level | Example Roles | Typical Permissions |
|---|---|---|
| Platform | admin, auditor | Full access, read all |
| Operations | operator, deployer | Deployment management |
| Read-only | viewer, support | View resources |
| Custom | env-prod-admin | Specific environment access |
Audit Compliance
Section titled “Audit Compliance”All authorization decisions are logged:
{ "event_type": "authz.permission_denied", "event_category": "authorization", "severity": "security", "actor_type": "user", "actor_id": "019b937d-4862-8e07-ac3a-1b8589d1b807", "actor_name": "alice", "action": "check_permission", "outcome": "denied", "outcome_reason": "Insufficient permission", "occurred_at": "2026-01-15T14:23:01"}Configuration
Section titled “Configuration”API Endpoints
Section titled “API Endpoints”| Endpoint | Description |
|---|---|
GET /api/v1/admin/users | List users |
GET /api/v1/admin/roles | List roles |
GET /api/v1/admin/permissions | List permissions |
POST /api/v1/admin/roles/{id}/permissions | Assign permissions |
POST /api/v1/admin/users/{id}/roles | Assign roles |
Required Permission to Manage RBAC
Section titled “Required Permission to Manage RBAC”| Action | Permission |
|---|---|
| View users | users:read |
| Create users | users:create |
| Modify users | users:update |
| Delete users | users:delete |
| List/view roles | roles:manage |
| Create roles | roles:create |
| Modify roles | roles:update |
| Assign/remove permissions | roles:manage |
Troubleshooting
Section titled “Troubleshooting”User Cannot Access Resource
Section titled “User Cannot Access Resource”-
Check user’s assigned roles:
Terminal window curl -s -H "Authorization: Bearer $TOKEN" \https://api.mantis.local/api/v1/admin/users/$USER_ID/roles -
Check role’s permissions:
Terminal window curl -s -H "Authorization: Bearer $TOKEN" \https://api.mantis.local/api/v1/admin/roles/$ROLE_ID/permissions -
Verify required permission for endpoint
Permission Denied Despite Having Role
Section titled “Permission Denied Despite Having Role”- Verify user-role assignment is active
- Check if permission is assigned to the role
- Review audit logs for specific denial reason
Next Steps
Section titled “Next Steps”- Users - User management
- Roles - Role configuration
- Permissions - Permission reference
- Tenant Isolation - Multi-tenant access control
