MATIH Platform is in active MVP development. Documentation reflects current implementation status.
6. Identity & Access Management
Roles & Permissions
Custom Roles

Custom Roles

Production - RoleService - custom role creation with fine-grained permissions

Custom roles allow tenant administrators to create application-specific roles with precisely tailored permission sets. Unlike system roles, custom roles can be freely modified and deleted.


6.5.4Creating a Custom Role

Step 1: Create the Role

curl -X POST http://localhost:8081/api/v1/roles \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <admin-token>" \
  -H "X-Tenant-ID: 550e8400-e29b-41d4-a716-446655440000" \
  -d '{
    "name": "bi-developer",
    "description": "Business intelligence developer with dashboard and query access"
  }'

Step 2: Assign Permissions

curl -X POST http://localhost:8081/api/v1/roles/10/permissions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <admin-token>" \
  -H "X-Tenant-ID: 550e8400-e29b-41d4-a716-446655440000" \
  -d '[5, 8, 12, 15]'

Step 3: Assign to Users

curl -X PUT http://localhost:8081/api/v1/users/42/roles \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <admin-token>" \
  -H "X-Tenant-ID: 550e8400-e29b-41d4-a716-446655440000" \
  -d '[1, 10]'

6.5.5System vs Custom Roles

AspectSystem RoleCustom Role
system flagtruefalse
ModifiableNoYes
DeletableNoYes
Created byDatabase migrationTenant admin
Examplesadmin, user, platform_adminbi-developer, data-steward

Role Design Best Practices

  1. Least privilege: Start with minimal permissions and add as needed
  2. Role hierarchy: Use parent roles to share common permission sets
  3. Naming conventions: Use lowercase with hyphens (e.g., data-analyst, bi-developer)
  4. Documentation: Always include a description explaining the role's purpose
  5. Regular review: Use the AccessReviewService for periodic access reviews