Skip to main content

Assign RBAC Role to Organization Member

PUT https://infrahub-api.nexgencloud.com/v1/auth/users/{user_id}/assign-roles

Assigns a specified Role-Based Access Control (RBAC) role to a member of your organization, granting them access to the resource actions permitted by the permissions and policies contained within the role. Include the ID of the user to which the RBAC role will be assigned in the path and the ID of the RBAC role in the body of the request.


Path parameters


user_id integer   Required

The ID of the organization member to which the role is being assigned.


Request body parameters


role_id string   Required

The ID of the RBAC role being assigned to an organization member.


Attributes


status boolean

Indicates the status of the request to assign an RBAC role to an organization member. true indicates success, while false indicates an error.


message string

A message describing the request to assign an RBAC role to a member.


role object

Returns the role object containing the details of the permissions and policies associated with the RBAC role that was assigned to the organization member. To learn more about the attributes of the role object, click here.


Example request
curl -X PUT "https://infrahub-api.nexgencloud.com/v1/auth/users/{user_id}/assign-roles" \
-H "accept: application/json" \
-H "api_key: YOUR API KEY" \
-H "content-type: application/json" \
-d '{
"role_id": 3,
}'

Response
{
"status": true,
"message": "Assigning RBAC Role success",
"role": {
"name": "example-role",
"policies": [
{
"name": "policy:ReadPermissions",
"description": "Gives read-only access to all resources",
"id": 2
}
],
"description": "Example RBAC role.",
"permissions": [
{
"permission": "environment:update",
"resource": "Environment",
"id": 4
}
],
"created_at": "2023-04-24T08:45:50",
"id": 3
}
}

Returns


The response will provide the status of the request, where true indicates success, along with the role object containing the configuration of the RBAC role that was assigned to the organization member. 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.



Back to top