Skip to content

RBAC Overview

Role-Based Access Control (RBAC) in Mantis provides granular security for all system resources.

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:

RoleDescription
adminFull system access with all permissions
operatorDeployment and target management
viewerRead-only access to resources
tenant_adminFull access within assigned tenant

Custom roles can be created to match your organizational needs.

Permissions grant specific actions on resources. Format: resource:action

ComponentExamples
Resourcedeployments, targets, actions, users
Actioncreate, read, update, delete

Example permissions:

  • deployments:create - Start new deployments
  • targets:read - View target information
  • users:delete - Remove user accounts

Users receive permissions through their roles:

User → Roles → Permissions

If a user has multiple roles, they receive the union of all permissions:

Every protected endpoint validates permissions:

// In handler
check_permission(&mut conn, audit, &auth.claims, "deployments:create").await?;

The check:

  1. Extracts user_id from JWT claims
  2. Queries database for user’s permissions via roles
  3. Returns success or logs denial to audit

Full system access:

  • All permissions across all resources
  • Cannot be modified or deleted
  • Typically assigned to platform administrators

Deployment operations:

  • Create, read, update actions/sequences/solutions
  • Create and manage deployments
  • Register and manage targets

Read-only access:

  • View deployments and their status
  • View targets and environments
  • View actions, sequences, solutions
  • Cannot make any modifications

Full access within tenant scope:

  • The seed grants tenant_admin every permission except five system-tier ones:
    • tenants:create - Cannot create new tenants
    • tenants:delete - Cannot delete tenants
    • system:admin - No system administration
    • settings:manage - Cannot modify system settings
    • audit: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 baseline viewer/operator roles. Everything else — including any future system-tier permission — is refused. See Permissions → Tenant Admin Role for details.
  • Ideal for delegated tenant management

When a user has a tenant_id:

  1. All queries are automatically filtered by tenant
  2. User can only access resources within their tenant
  3. Cross-tenant access returns 404 (not 403) to prevent enumeration

Assign the minimum permissions required:

Create roles matching your organization:

LevelExample RolesTypical Permissions
Platformadmin, auditorFull access, read all
Operationsoperator, deployerDeployment management
Read-onlyviewer, supportView resources
Customenv-prod-adminSpecific environment access

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"
}
EndpointDescription
GET /api/v1/admin/usersList users
GET /api/v1/admin/rolesList roles
GET /api/v1/admin/permissionsList permissions
POST /api/v1/admin/roles/{id}/permissionsAssign permissions
POST /api/v1/admin/users/{id}/rolesAssign roles
ActionPermission
View usersusers:read
Create usersusers:create
Modify usersusers:update
Delete usersusers:delete
List/view rolesroles:manage
Create rolesroles:create
Modify rolesroles:update
Assign/remove permissionsroles:manage
  1. Check user’s assigned roles:

    Terminal window
    curl -s -H "Authorization: Bearer $TOKEN" \
    https://api.mantis.local/api/v1/admin/users/$USER_ID/roles
  2. Check role’s permissions:

    Terminal window
    curl -s -H "Authorization: Bearer $TOKEN" \
    https://api.mantis.local/api/v1/admin/roles/$ROLE_ID/permissions
  3. Verify required permission for endpoint

  1. Verify user-role assignment is active
  2. Check if permission is assigned to the role
  3. Review audit logs for specific denial reason