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
noneResponse
name - name of the security roleid - unique ID of the security rolesearchID - ID used by other APIs for searching purposesgroups - array list of groups this role is inusers - array list of roles assigned to this grouprepos - array list of repositories assigned this roletype - data type of the role - "role"description - description of the security roleExample 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 roleResponse
name - name of the security roleid - unique ID of the security rolesearchID - ID used by other APIs for searching purposesgroups - array list of groups this role is inusers - array list of roles assigned to this grouprepos - array list of repositories assigned this roletype - data type of the role - "role"description - description of the security roleExample 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 roleRequest
id - ID of the new username - name of the new userdescription(optional): description of the new userResponse
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 updateRequest
groups: Array of user groups to replace the groups for the desired userroles: Array of user roles to replace the roles for the desired userResponse
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 deleteResponse
200 - OK on success