Skip to content
Authorization Check

Authorization Check

Endpoints for checking whether the current admin user is authorized to perform specific dashboard actions. These use the internal Cedar policy engine.

Check Single Action

POST /api/authz/check

Authentication

Requires admin Bearer token.

Request Body

{
  action: string           // Required: The action to check (e.g. "list_users", "create_policy")
  resourceType?: string    // Optional: Resource type (default: "dashboard")
  context?: object         // Optional: Additional context for the authorization decision
}

Example Request

curl -X POST http://localhost:3100/api/authz/check \
  -H "Authorization: Bearer your-admin-token" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "create_policy",
    "resourceType": "dashboard"
  }'

Success Response

{
  "allowed": true,
  "reason": "permit policy matched"
}

Error Responses

StatusCodeDescription
400MISSING_ACTIONaction field is required
403ENTITY_NOT_FOUNDDashboard user entity not found
500INTERNAL_ERRORAuthorization check failed

Batch Check Actions

POST /api/authz/check-batch

Check multiple actions in a single request.

Request Body

{
  actions: Array<{
    action: string           // Required: Action to check
    resourceType?: string    // Optional: Resource type (default: "dashboard")
  }>
}

Example Request

curl -X POST http://localhost:3100/api/authz/check-batch \
  -H "Authorization: Bearer your-admin-token" \
  -H "Content-Type: application/json" \
  -d '{
    "actions": [
      { "action": "list_users" },
      { "action": "create_policy" },
      { "action": "delete_provider" }
    ]
  }'

Success Response

{
  "results": [
    { "action": "list_users", "allowed": true },
    { "action": "create_policy", "allowed": true },
    { "action": "delete_provider", "allowed": false }
  ]
}

Error Responses

StatusCodeDescription
400INVALID_ACTIONSactions must be an array
403ENTITY_NOT_FOUNDDashboard user entity not found

Available Dashboard Actions

These are the internal Cedar actions that can be checked:

CategoryActions
Userslist_users, get_user, create_user, update_user, delete_user, reset_user_password
Keyslist_keys, create_key, delete_key, rotate_key
Policieslist_policies, create_policy, update_policy, delete_policy, patch_policy_status, get_policy_templates, generate_policy
Entitieslist_entities, update_entity
Roleslist_roles, create_role, delete_role
Schemaget_schema, update_schema
Providerslist_providers, get_provider, create_provider, delete_provider, test_provider
Configget_config, update_config
Dashboard Userslist_dashboard_users, get_dashboard_user, create_dashboard_user, update_dashboard_user, delete_dashboard_user, reset_dashboard_user_password
Audit & Statsview_audit_logs, view_audit_statistics, view_stats, view_costs, view_events, view_internal_audit