Update RBAC Role
PUT https://infrahub-api.nexgencloud.com/v1/auth/roles/{id}
Updates the configuration of a specified Role-Based Access Control (RBAC) role, enabling you to modify its permissions, policies, name, and description.
Path parameters
id integer
Required
The ID of the RBAC role to be updated. In this example, the RBAC role with an ID of "64" was specified.
Request body parameters
Please ensure that the request includes at least one valid ID for either the policies
or permissions
fields.
name string
Required
The new name of the RBAC role.
description string
Required
A new description of the RBAC role.
policies integer
Required
The ID(s) of the policies to be assigned to the RBAC role.
permissions integer
Required
The ID(s) of the permissions to be assigned to the RBAC role.
Attributes
status boolean
Indicates the status of the request to update an RBAC role. true
indicates success, while false
indicates an error.
message string
A message describing the request to update an RBAC role.
role object
Returns the role
object containing the details of the permissions and policies associated with the modified RBAC role. To learn more about the attributes of the role
object, click here.
curl -X PUT "https://infrahub-api.nexgencloud.com/v1/auth/roles/{id}" \
-H "accept: application/json" \
-H "api_key: YOUR API KEY" \
-H "content-type: application/json" \
-d '{
"name": "example-updated-role",
"description": "Example of an RBAC role being updated.",
"policies": [
2
],
"permissions": [
2
]
}'
{
"status": true,
"message": "RBAC Role updated successfully",
"role": {
"policies": [
{
"description": "Gives read-only access to all resources",
"id": 2,
"name": "policy:ReadPermissions"
}
],
"name": "example-updated-role",
"permissions": [
{
"resource": "Environment",
"permission": "environment:create",
"id": 2
}
],
"description": "Example of an RBAC role being updated.",
"created_at": "2024-02-08T09:45:34",
"id": 64
}
}
Returns
The response will provide the status of the request, where true
indicates success, along with the role
object containing the modified configuration of the RBAC role. Within the role
object, you'll find information about the permissions and policies assigned to the role, role ID, timestamp of creation, and the name and description you gave the role.