Skip to content

REST: System and project roles management

azhuchkov edited this page Jan 28, 2013 · 17 revisions

Genesis system roles

List all system roles

Path: /rest/roles

Type: GET

Example:

Response:

[ "ROLE_GENESIS_ADMIN", "ROLE_GENESIS" ]

Get users and groups assign that have specific role assigned

Path: /rest/roles/(roleName)

Type: GET

Example:

Response:

{
  "name":"ROLE_GENESIS",
  "users":[],
  "groups":["asdcasdcas","qqqq","rafael","something"]
}

Set list of users and group that have role assignment

Path: /rest/roles/(roleName)

Type: PUT

Request body

consists form a single JSON map contains the following entries:

Entry name Type Mandatory Description
users List of strings Y List of usernames
groups List of string Y List of group names

Example:

Request:

  {
    "users": ["ninja"],
    "groups": ["some group"]
  }

Response:

{
    "isSuccess": true, 
    "result": {
        "nonExistentGroups": [
            "group"
        ], 
        "nonExistentUsers": [
            "username"
        ]
    }
}

Genesis project roles

List all project roles

Path: /rest/projectRoles

Type: GET

Example:

Response:

[
    {"name": "ROLE_GENESIS_PROJECT_ADMIN"},{ "name": "ROLE_GENESIS_PROJECT_USER"}
]

Get all groups and users that have project role assigned

Path: /rest/projects/(projectId)/roles/(roleName)

Type: GET

Path parameters:

Parameter Type Description
projectId Number project id the env belong to
roleName String One of valid project roles (returned by /rest/projectRoles)

Response body

ExtendedRequestResult json object

Example:

Response:

{
    "result":{
        "users":[],
        "groups":["turtles"]
    },
    "isSuccess":true
}

Assign users and groups to project role

Path: /rest/projects/(projectId)/roles/(roleName)

Type: PUT

Path parameters:

Parameter Type Description
projectId Number project id the env belong to
roleName String One of valid project roles (returned by /rest/projectRoles)

Request body

consists form a single JSON map contains the following entries:

Entry name Type Mandatory Description
users List of strings Y List of usernames
groups List of string Y List of group names

Request body

RequestResult json object

Example:

Request:

{"users":["ninja"],"groups":["some group"]}

Response:

{
    "isSuccess": true, 
    "result": {
        "nonExistentGroups": [
            "group"
        ], 
        "nonExistentUsers": [
            "username"
        ]
    }
}

Get list of roles current user has in project

Path: /rest/projects/(projectId)/permissions

Type: GET

Path parameters:

Parameter Type Description
projectId Number project id the env belong to

Example:

Response body:

["ROLE_GENESIS_PROJECT_ADMIN", "ROLE_GENESIS_PROJECT_USER"]
Clone this wiki locally