Skip to content

REST: System and project roles management

bugzmanov edited this page Aug 2, 2012 · 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:

{
    "serviceErrors":{},
    "variablesErrors":{},
    "compoundServiceErrors":[],
    "compoundVariablesErrors":[],
    "isSuccess":true,
    "isNotFound":false
}

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:**

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

**Request body**

consists form a single JSON map contains the following entries:

<table>
<tr>
<th>
Entry name
</th>
<th>
Type
</th>
<th>
Mandatory
</th>
<th>
Description
</th>
</tr>
<tr>
<td>
users
</td>
<td>
List of strings
</td>
<td>
Y
</td>
<td>
List of usernames
</td>
</tr>
<tr>
<td>
groups
</td>
<td>
List of string
</td>
<td>
Y
</td>
<td>
List of group names
</td>
</tr>
</table>

**Request body**

RequestResult json object

**Example:**

**Request:**

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

Response:

{
    "serviceErrors":{},
    "variablesErrors":{},
    "compoundServiceErrors":[],
    "compoundVariablesErrors":[],
    "isSuccess":true,
    "isNotFound":false
}

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