# RoleService

Manages the roles in Deployit's security system.

GET | /security/role/ | Lists the names of all available roles in the security system.
GET | /security/role/roles | Lists the roles of the currently logged in user.
GET | /security/role/roles/{username} | Lists the roles of a user.
PUT | /security/role/{role} | Creates a new role.
POST | /security/role/{role} | Renames a role.
DELETE | /security/role/{role} | Removes a role from the Deployit security system.
PUT | /security/role/{role}/{principal} | Assigns a role to a user or group.
DELETE | /security/role/{role}/{principal} | Removes a role from a user or group.

## GET /security/role/

Lists the names of all available roles in the security system.

Response body
  List of String - a list of role names.
  Content type: application/xml, application/json

## GET /security/role/roles

Lists the roles of the currently logged in user.

Response body
  List of String - a list of role names.
  Content type: application/xml, application/json

## GET /security/role/roles/{username}

Lists the roles of a user.

Permissions
  `security#edit`

Parameters

  Request body | application/xml, application/json | String | the username of the principal

Response body
  List of String - a list of role names.
  Content type: application/xml, application/json

## PUT /security/role/{role}

Creates a new role. Does nothing if the role already exists.

Permissions
  `security#edit`

Parameters

  Path | role | String | the name of the new role.

Response body
  Empty

## POST /security/role/{role}

Renames a role. Does nothing if the role does not exist.

Permissions
  `security#edit`

Parameters

  Path | role | String | the current name
  Request body | application/xml, application/json | String | the new name

Response body
  Empty

## DELETE /security/role/{role}

Removes a role from the Deployit security system. All assignments to principals are deleted as well.

Permissions
  `security#edit`

Parameters

  Path | role | String | the name of the role to delete.

Response body
  Empty

## PUT /security/role/{role}/{principal}

Assigns a role to a user or group. The role will be created if it doesn't exist yet.

Permissions
  `security#edit`

Parameters

  Path | role | String | the name of the role to assign
  Path | principal | String | the user or group to assign the role to.

Response body
  Empty

## DELETE /security/role/{role}/{principal}

Removes a role from a user or group.

Permissions
  `security#edit`

Parameters

  Path | role | String | the name of the role to remove
  Path | principal | String | the user or group to remove the role from.

Response body
  Empty