The CloudBees Role-Based Access Control plugin provides endpoints, which allow managing groups and roles using POST requests. It is also possible to retrieve the data in various formats using CloudBees CI standard REST API functionality.
Authentication
To access the Role-based access control (RBAC) management API you need an API authentication token. See API authentication for more information.
Authorization depends on the endpoints and/or methods. See the required permissions in Endpoints and methods.
Endpoints and methods
Managing RBAC group containers
This set of commands allows managing groups in various group containers: root, folders, jobs and nodes. Endpoint URL examples:
-
${JENKINS_URL}/groups
-
${JENKINS_URL}/job/folder1/job/folder2/groups
-
${JENKINS_URL}/job/folder1/job/myJob/groups
-
${JENKINS_URL}/computer/node1/groups
Endpoint | Required permissions | Description | Parameters |
---|---|---|---|
GET |
Group.VIEW |
Lists groups in the container. |
|
POST |
Group.CREATE |
Creates a new group. |
|
POST |
Group.DELETE |
Deletes a group. |
|
POST |
Roles.FILTER |
Adds a role filter. A role filter allows roles to be filtered in the container if these roles are filterable. |
|
POST |
Roles.FILTER |
Deletes a role filter. |
|
Managing RBAC groups individually
After creating groups using the commands above, you may need to configure the groups. For each group, the API endpoint can be accessed by its group URL. Endpoint examples:
-
${JENKINS_URL}/groups/myGroupName
-
${JENKINS_URL}/job/folder1/job/myJob/groups/myGroupName
-
${JENKINS_URL}/computer/node1/groups/myGroupName
Endpoint | Required permissions | Description | Parameters |
---|---|---|---|
POST |
Group.MANAGE |
Sets the group description. |
|
POST |
Group.MANAGE |
Adds a new user to the group. |
|
POST |
Group.MANAGE |
Removes a user from a group. |
|
POST |
Group.MANAGE |
Adds a new internal RBAC group or external (from the security realm) group to the |
|
POST |
Group.MANAGE |
Removes internal or external groups. |
|
POST |
Group.MANAGE |
Grants a role to this group. Overrides the current settings if they exist. |
|
POST |
Roles.FILTER |
Deletes a role filter. |
|
Managing RBAC global roles
On the top level of Jenkins you can create and manage roles. Endpoint URL for overall group management: ${JENKINS_URL}/roles.
Endpoint | Required permissions | Description | Parameters |
---|---|---|---|
GET |
Jenkins.ADMINISTER |
Lists all global roles. |
|
POST |
Jenkins.ADMINISTER |
Creates a new role. |
|
POST |
Jenkins.ADMINISTER |
Removes a role. |
|
POST |
Jenkins.ADMINISTER |
Adds a role to the list of filterable roles. |
|
POST |
Jenkins.ADMINISTER |
Remove role from the list of filterable roles. |
|
Managing RBAC roles individually
After creating roles it is possible to manage them individually. Endpoint URL for individual group management: ${JENKINS_URL}/roles/{ROLE_NAME}
.
Endpoint | Required permissions | Description | Parameters |
---|---|---|---|
POST |
Jenkins.ADMINISTER |
Grants permissions to the role. |
|
POST |
Jenkins.ADMINISTER |
Revokes permissions from the role. |
|
Request examples
Group containers
Endpoint | Request example |
---|---|
GET |
|
POST |
|
POST |
|
POST |
|
In the request examples "admin" is the name of the user attempting to send the request and "https://my-operations-center.com/cjoc/" is the url for the operations center. |
The -g option switches off the "URL globbing parser" for curl. When you set this option, you can specify URLs that contain the letters {}[] without having them being interpreted by curl itself. Note that these letters are not normal legal URL contents but they should be encoded according to the URI standard.
|
Groups individually
Endpoint | Request example | ||
---|---|---|---|
POST |
|
||
POST |
|
||
POST |
|
||
POST |
|
||
POST |
|
In the request examples "admin" is the name of the user attempting to send the request and "https://my-operations-center.com/cjoc/" is the url for the operations center. |
Global roles
Endpoint | Request example |
---|---|
GET |
|
POST |
|
POST |
|
POST |
|
POST |
|
In the request examples "admin" is the name of the user attempting to send the request and "https://my-operations-center.com/cjoc/" is the url for the operations center. |
The -g option switches off the "URL globbing parser" for curl. When you set this option, you can specify URLs that contain the letters {}[] without having them being interpreted by curl itself. Note that these letters are not normal legal URL contents but they should be encoded according to the URI standard.
|
Individual roles
Endpoint | Request example |
---|---|
POST |
|
POST |
|
In the request examples "admin" is the name of the user attempting to send the request and "https://my-operations-center.com/cjoc/" is the url for the operations center. |
Response examples
{ "_class": "nectar.plugins.rbac.groups.RootProxyGroupContainer", "groups": [ { "description": null, "users": [ "ada", "john" ], "groups": [ "dev-group" ], "members": [ "ada", "john", "dev-group" ], "name": "Developers", "roleAssignments": [ {} ], "roles": [ "develop" ], "url": "groups/Developers/" }, { "description": null, "users": [ "jane", "tom" ], "groups": [], "members": [ "jane", "tom" ], "name": "Browsers", "roleAssignments": [ {} ], "roles": [ "browse" ], "url": "groups/Browsers/" }, { "description": null, "users": [ "admin" ], "groups": [], "members": [ "admin" ], "name": "Administrators", "roleAssignments": [ {} ], "roles": [ "administer" ], "url": "groups/Administrators/" } ] }
{ "_class": "nectar.plugins.rbac.groups.RootProxyGroupContainer$RootRolesAction", "roles": [ { "filterable": false, "grantedPermissions": [ "com.cloudbees.pipeline.governance.templates.catalog.TemplateCatalogAction.ViewCatalogs" ], "id": "authenticated", "id": "authenticated" }, { "filterable": false, "grantedPermissions": [ "com.cloudbees.jenkins.plugin.metrics.views.Alerter.Mute", "com.cloudbees.jenkins.plugin.metrics.views.Alerter.View", "com.cloudbees.jenkins.support.SupportPlugin.DownloadBundle", "com.cloudbees.opscenter.server.model.ClientMaster.Configure", "com.cloudbees.opscenter.server.model.ClientMaster.Lifecycle", "com.cloudbees.opscenter.server.model.SharedCloud.Configure", "com.cloudbees.opscenter.server.model.SharedCloud.Connect", "com.cloudbees.opscenter.server.model.SharedCloud.Disconnect", "com.cloudbees.opscenter.server.model.SharedCloud.ForceRelease", "com.cloudbees.pipeline.governance.templates.catalog.TemplateCatalogAction.ManageCatalogs", "com.cloudbees.pipeline.governance.templates.catalog.TemplateCatalogAction.ViewCatalogs", "com.cloudbees.plugins.credentials.CredentialsProvider.Create", "com.cloudbees.plugins.credentials.CredentialsProvider.Delete", "com.cloudbees.plugins.credentials.CredentialsProvider.ManageDomains", "com.cloudbees.plugins.credentials.CredentialsProvider.Update", "com.cloudbees.plugins.credentials.CredentialsProvider.View", "com.cloudbees.plugins.updatecenter.UpdateCenter.Configure", "com.cloudbees.plugins.updatecenter.UpdateCenter.Promote", "com.cloudbees.plugins.updatecenter.UpdateCenter.Store", "com.cloudbees.plugins.updatecenter.UpdateCenter.Upload", "hudson.model.Computer.Build", "hudson.model.Computer.Configure", "hudson.model.Computer.Connect", "hudson.model.Computer.Create", "hudson.model.Computer.Delete", "hudson.model.Computer.Disconnect", "hudson.model.Computer.Provision", "hudson.model.Computer.Secure", "hudson.model.Computer.ViewOwners", "hudson.model.Hudson.Administer", "hudson.model.Hudson.ConfigureUpdateCenter", "hudson.model.Hudson.Manage", "hudson.model.Hudson.Read", "hudson.model.Hudson.RunScripts", "hudson.model.Hudson.UploadPlugins", "hudson.model.Item.Build", "hudson.model.Item.Cancel", "hudson.model.Item.Configure", "hudson.model.Item.Create", "hudson.model.Item.Delete", "hudson.model.Item.Discover", "hudson.model.Item.Move", "hudson.model.Item.Promote", "hudson.model.Item.Read", "hudson.model.Item.Request", "hudson.model.Item.Workspace", "hudson.model.Run.Delete", "hudson.model.Run.Replay", "hudson.model.Run.Update", "hudson.model.View.Configure", "hudson.model.View.Create", "hudson.model.View.Delete", "hudson.model.View.Read", "hudson.scm.SCM.Tag", "jenkins.metrics.api.Metrics.HealthCheck", "jenkins.metrics.api.Metrics.ThreadDump", "jenkins.metrics.api.Metrics.View", "nectar.plugins.rbac.groups.Group.Configure", "nectar.plugins.rbac.groups.Group.Create", "nectar.plugins.rbac.groups.Group.Delete", "nectar.plugins.rbac.groups.Group.Manage", "nectar.plugins.rbac.groups.Group.View", "nectar.plugins.rbac.roles.Role.Filter", "nectar.plugins.rbac.roles.Role.View" ], "id": "administer", "id": "administer" }, { "filterable": false, "grantedPermissions": [], "id": "anonymous", "id": "anonymous" }, { "filterable": true, "grantedPermissions": [ "com.cloudbees.opscenter.server.model.ClientMaster.Configure", "com.cloudbees.opscenter.server.model.ClientMaster.Lifecycle", "com.cloudbees.opscenter.server.model.SharedCloud.Configure", "hudson.model.Hudson.Read", "hudson.model.Item.Build", "hudson.model.Item.Cancel", "hudson.model.Item.Configure", "hudson.model.Item.Create", "hudson.model.Item.Delete", "hudson.model.Item.Discover", "hudson.model.Item.Move", "hudson.model.Item.Promote", "hudson.model.Item.Read", "hudson.model.Item.Request", "hudson.model.Item.Workspace", "hudson.model.Run.Delete", "hudson.model.Run.Replay", "hudson.model.Run.Update", "hudson.model.View.Configure", "hudson.model.View.Create", "hudson.model.View.Delete", "hudson.model.View.Read", "hudson.scm.SCM.Tag" ], "id": "develop", "id": "develop" }, { "filterable": true, "grantedPermissions": [ "hudson.model.Hudson.Read", "hudson.model.Item.Discover", "hudson.model.Item.Read", "hudson.model.View.Read" ], "id": "browse", "id": "browse" } ] }
The members attribute has been deprecated. Use either the users or groups attribute instead.
|
Response examples are formatted for better readability. |
Response model
Element | Type | Description | ||
---|---|---|---|---|
groups |
array of objects |
List of all groups in the container. |
||
name |
string |
Group name. |
||
description |
string |
Description of the group (raw string - no spaces). |
||
roles |
array |
List of roles assigned to this group. |
||
roleAssignments |
array |
List of all group assignments including inherited ones. Each role assignment has a role field with role IDs. |
||
users |
array |
List of users in a group. |
||
members
|
array |
List of group members (user IDs, inner groups, etc). |
Element | Type | Description |
---|---|---|
roles |
array of objects |
List of available roles. |
id |
string |
Description of the group (raw string - no spaces). |
roles |
array |
Role identifier. |
description |
string |
Role description. |
url |
string |
URL of the role’s page. |
grantedPermissions |
array |
Assigned permissions (including local and provisioned ones). All items contain the id field with the permission unique identifier and enabled field, which indicates that the permission can be assigned. |
filterable |
boolean |
Indicates that the role is filterable. |