Assign Role To User In Organization
organizations.users.assign_role(strpath_organization_id, UserAssignRoleParams**kwargs) -> UserOrganizationRole
PUT/api/v1/organizations/{organization_id}/users/roles
Assign a role to a user in an organization.
Assign Role To User In Organization
import os
from llama_cloud_admin import LlamaCloudAdmin
client = LlamaCloudAdmin(
api_key=os.environ.get("LLAMA_CLOUD_API_KEY"), # This is the default and can be omitted
)
user_organization_role = client.organizations.users.assign_role(
path_organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
body_organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
role_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
user_id="user_id",
)
print(user_organization_role.id){
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"organization_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"role": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"name": "x",
"permissions": [
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"access": true,
"description": "description",
"name": "x",
"created_at": "2019-12-27T18:11:19.117Z",
"updated_at": "2019-12-27T18:11:19.117Z"
}
],
"created_at": "2019-12-27T18:11:19.117Z",
"updated_at": "2019-12-27T18:11:19.117Z"
},
"user_id": "user_id",
"created_at": "2019-12-27T18:11:19.117Z",
"project_ids": [
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
],
"updated_at": "2019-12-27T18:11:19.117Z"
}Returns Examples
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"organization_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"role": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"name": "x",
"permissions": [
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"access": true,
"description": "description",
"name": "x",
"created_at": "2019-12-27T18:11:19.117Z",
"updated_at": "2019-12-27T18:11:19.117Z"
}
],
"created_at": "2019-12-27T18:11:19.117Z",
"updated_at": "2019-12-27T18:11:19.117Z"
},
"user_id": "user_id",
"created_at": "2019-12-27T18:11:19.117Z",
"project_ids": [
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
],
"updated_at": "2019-12-27T18:11:19.117Z"
}