Skip to content

Roles

These API’s are for creating, accessing, and maintaining security roles inside of CM Box.

GET /api/security/roles

Retrieves a list of security roles

Params

none

Response

name - name of the security role
id - unique ID of the security role
searchID - ID used by other APIs for searching purposes
groups - array list of groups this role is in
users - array list of roles assigned to this group
repos - array list of repositories assigned this role
type - data type of the role - "role"
description - description of the security role

Example Response

[
{
"name": "admin",
"id": "admin",
"searchId": "admin",
"groups": ["Example Group"],
"users": ["user1@fishbowlsolutions.com"],
"repos": [
{
"CACHE_ROOT": "Test1",
"id": "c4069b84-4f1b-451a-4363-c72c942c8b09",
"permission": "maintainers"
},
{
"CACHE_ROOT": "test",
"id": "8cd4a8ba-3245-428f-af9e-17ff46ac2cb9",
"permission": "maintainers"
}
],
"type": "role",
"description": "Admin role",
"_key": "fb:middleware:security:roles:admin"
},
{
"name": "publisher",
"id": "publisher",
"searchId": "publisher",
"groups": [],
"users": [],
"repos": [],
"type": "role",
"description": "Publishers of content",
"_key": "fb:middleware:security:roles:publisher"
}
]

GET /api/security/roles/:role_id

Retrieves a security role using the role id

Params

:role_id - ID of the requested security role

Response

name - name of the security role
id - unique ID of the security role
searchID - ID used by other APIs for searching purposes
groups - array list of groups this role is in
users - array list of roles assigned to this group
repos - array list of repositories assigned this role
type - data type of the role - "role"
description - description of the security role

Example Response

{
"id": "admin",
"searchId": "admin",
"name": "admin",
"groups": ["Example Group"],
"users": ["user1@fishbowlsolutions.com"],
"repos": [
{
"CACHE_ROOT": "Test1",
"id": "c4069b84-4f1b-451a-9988-c72c942c8b09",
"permission": "maintainers"
},
{
"CACHE_ROOT": "test",
"id": "8cd4a8ba-9555-428f-af9e-17ff46ac2cb9",
"permission": "maintainers"
}
],
"type": "role",
"description": "Admin role",
"_key": "fb:middleware:security:roles:admin"
}

POST /api/security/roles/:role_id

Creates a new security role

Params

:role_id - ID of the new security role

Request

id - ID of the new user
name - name of the new user
description(optional): description of the new user

Response

200 - OK on success

Example response

{
"id": "test1",
"name": "Tester",
"groups": [],
"users": [],
"repos": [],
"type": "role",
"description": "tester"
}

PUT /api/security/roles/:user_id

Used to add groups to a user based on the user ID

Params

:user_id: ID of the user you wish to update

Request

groups: Array of user groups to replace the groups for the desired user
roles: Array of user roles to replace the roles for the desired user

Response

200 - OK on success

DELETE /api/security/roles/role_id

Used to delete a role based on the role id

Params

role_id: ID of the role you wish to delete

Response

200 - OK on success