PUT /roles/<rid>

Replaces the content of the specified role object. For example, you can update the role's permissions or user membership. Authentication is required.

Request format

When Forming RBAC API requests to this endpoint, the content type is application/json. The body must be a JSON object using all keys supplied in the GET /roles/<rid> endpoint response. You must supply all keys; however, you can't update the id key. Any values supplied in editable keys replace the role's current values. If you want to values, you need to supply all of the role's current values plus the new values. If you supply an empty array (or a null description), the current content is removed. For example, supplying an empty user_ids array removes any individual users that were assigned to the role.

For example:

curl -X PUT "https://$(puppet config print server):4433/rbac-api/v1/<rid>" \
-H "X-Authentication: $(puppet-access show)"  \
-H "Content-type: application/json" \
-d '{
     "permissions": [{"object_type":"node_groups", "action":"edit_rules", "instance":"*"}],
     "user_ids": ["1cadd0e0-5887-11e4-8ed6-0800200c9a66", "5c1ab4b0-588b-11e4-8ed6-0800200c9a66"],
     "group_ids": ["2ca57e30-5887-11e4-8ed6-0800200c9a66"],
     "display_name": "A role",
     "description": "Edit node group rules"}'

Response format

If the operation is successful, the endpoint returns a 200 OK response with the updated role object.

Error responses

For errors, refer to RBAC service errors .