Assign roles to a user
Description
URL |
scheme://domain:port/platform/ws/roles/assign |
|
Description |
The logged on user must have view_configure permission on the setting resource to use this API. Assigns roles to a specified user. |
|
HTTP-Method |
POST |
|
Parameters |
Name |
Description |
username |
Mandatory. Specify the user to which to assign roles. To specify multiple users, separate with a comma(,). For example: user1,user2. Use the API /platform/ws/users/ to get a list of users. |
|
roles |
Mandatory. Specify the role to be assigned to the user. To specify multiple roles, separate with a comma(,). For example: cluster_admin,myrole. Use the API /platform/ws/roles/ to get a list of roles. |
Request
Request-Method |
POST |
|
Request-URI |
/platform/ws/roles/assign |
|
Request-Header |
Name |
Value |
Accept |
application/xml or application/json |
|
Message-body |
username=%s&roles=%s |
Response
Response |
Response Information |
|
Response-Code |
|
|
Response-Header |
Name | Value |
Content-Type |
application/xml or application/json |
|
Location (Only if response code is 303) |
A URI that gets the roles of specified user. |
|
Message-body |
Failure Message | If not successful, returns an error message. For additional information, refer to the schema file ./schemas/rbac/error.xsd.
|
Example: Assign the roles test_role0, test_role1 to user0
# Request
POST /platform/ws/roles/assign HTTP/1.1
Host: www.example.org
username=user0&roles=test_role0,test_role1
# Response
303 See Other
Location: http://www.example.org/platfrom/ws/roles?username=user0
Related APIs
To get a list of users, use the API /platform/ws/users.
To get a list of roles, use the API /platform/ws/roles.