Roles

Grant a role to a user

Changed on

Grants the role to the user as a DIRECT membership. The operation is IDEMPOTENT: granting a role the user already holds returns 200 and changes nothing — no duplicate membership is created and retries are safe, even when the role's editUsers flag has since been turned off. Note the inherited-membership behavior (legacy parity): role membership is inherited DOWN the role tree, so a user holding a parent role implicitly holds every child role. Granting a role the user already INHERITS this way also returns 200 but does NOT create a direct membership — the user will not appear in the role's direct-users list afterwards. Roles whose editUsers flag is false cannot be granted (403); workflow and system roles are non-grantable because that flag is false on them.

post/api/v1/roles/{roleid}/users/{userId}

Request

Path parameters

roleidstring required

Id of the role to grant

userIdstring required

Id of the user to grant the role to

Response

User holds the role after the call; the response carries the granted roleId and a minimal user payload

i18nMessagesMapobject
permissionsstring[]

Example response

{
  "entity": {
    "granted": true,
    "roleId": "48190c8c-42c4-46af-8d1a-0cd5db894797",
    "user": {
      "userId": "dotcms.org.2807",
      "email": "user@example.com",
      "fullName": "Jane Doe"
    }
  }
}

Changes