API Reference - Admin Role Permissions

Link: https://support.brilliantdirectories.com/support/solutions/articles/12000108129

← Back to API Reference | Getting Started

Admin Role Permissions

Admin Role Permissions link an admin role to individual permissions, controlling what actions sub-administrators assigned to that role can perform. Each record associates a role with a specific permission and indicates whether the role can view that permission area. Use these alongside Admin Roles to build fine-grained access control for your admin team.

Model name in URL: admin_role_permissions — DB table: admin_role_permissions

The Admin Role Permission Object

FieldTypeDescription
role_permission_idintegerUnique permission assignment ID (primary key, read-only)
role_idintegerForeign key referencing the admin_roles table required on create
permission_idintegerForeign key referencing the admin_permissions table required on create
assigned_byintegerForeign key referencing the administrator who assigned this permission required on create
can_viewintegerFlag indicating whether this role can view the permission area; 1 = visible, 0 = hidden

List Admin Role Permissions

GET /api/v2/admin_role_permissions/get

Example Request

Copy
curl -X GET "https://www.yourdomain.com/api/v2/admin_role_permissions/get?limit=25" \
  -H "X-Api-Key: your-api-key-here"

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "role_permission_id": "329",
      "role_id": "4",
      "permission_id": "103",
      "assigned_by": "27",
      "can_view": "0"
    },
    {
      "role_permission_id": "328",
      "role_id": "4",
      "permission_id": "102",
      "assigned_by": "27",
      "can_view": "0"
    }
  ],
  "total": "73",
  "current_page": 1,
  "total_pages": 3,
  "next_page": "MipfKjI1"
}

Retrieve an Admin Role Permission

GET /api/v2/admin_role_permissions/get/{role_permission_id}

Example Request

Copy
curl -X GET "https://www.yourdomain.com/api/v2/admin_role_permissions/get/329" \
  -H "X-Api-Key: your-api-key-here"

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "role_permission_id": "329",
      "role_id": "4",
      "permission_id": "103",
      "assigned_by": "27",
      "can_view": "0"
    }
  ],
  "total": "73",
  "current_page": 1,
  "total_pages": 3
}

Create an Admin Role Permission

POST /api/v2/admin_role_permissions/create

Example Request

Copy
curl -X POST "https://www.yourdomain.com/api/v2/admin_role_permissions/create" \
  -H "X-Api-Key: your-api-key-here" \
  -d "role_id=4" \
  -d "permission_id=50" \
  -d "assigned_by=27" \
  -d "can_view=1"

Example Response

Copy
{
  "status": "success",
  "message": {
    "role_permission_id": "330",
    "role_id": "4",
    "permission_id": "50",
    "assigned_by": "27",
    "can_view": "1"
  }
}

Update an Admin Role Permission

PUT /api/v2/admin_role_permissions/update

Example Request

Copy
curl -X PUT "https://www.yourdomain.com/api/v2/admin_role_permissions/update" \
  -H "X-Api-Key: your-api-key-here" \
  -d "role_permission_id=330" \
  -d "can_view=0"

Example Response

Copy
{
  "status": "success",
  "message": {
    "role_permission_id": "330",
    "role_id": "4",
    "permission_id": "50",
    "assigned_by": "27",
    "can_view": "0"
  }
}

Delete an Admin Role Permission

DELETE /api/v2/admin_role_permissions/delete

Example Request

Copy
curl -X DELETE "https://www.yourdomain.com/api/v2/admin_role_permissions/delete" \
  -H "X-Api-Key: your-api-key-here" \
  -d "role_permission_id=330"

Example Response

Copy
{
  "status": "success",
  "message": "admin_role_permissions record was deleted"
}