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.
admin_role_permissions — DB table: admin_role_permissionsThe Admin Role Permission Object
| Field | Type | Description |
|---|---|---|
role_permission_id | integer | Unique permission assignment ID (primary key, read-only) |
role_id | integer | Foreign key referencing the admin_roles table required on create |
permission_id | integer | Foreign key referencing the admin_permissions table required on create |
assigned_by | integer | Foreign key referencing the administrator who assigned this permission required on create |
can_view | integer | Flag indicating whether this role can view the permission area; 1 = visible, 0 = hidden |
List Admin Role Permissions
Example Request
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
{
"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
Example Request
curl -X GET "https://www.yourdomain.com/api/v2/admin_role_permissions/get/329" \ -H "X-Api-Key: your-api-key-here"
Example Response
{
"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
Example Request
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
{
"status": "success",
"message": {
"role_permission_id": "330",
"role_id": "4",
"permission_id": "50",
"assigned_by": "27",
"can_view": "1"
}
}Update an Admin Role Permission
Example Request
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
{
"status": "success",
"message": {
"role_permission_id": "330",
"role_id": "4",
"permission_id": "50",
"assigned_by": "27",
"can_view": "0"
}
}Delete an Admin Role Permission
Example Request
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
{
"status": "success",
"message": "admin_role_permissions record was deleted"
}