# PermissionService

Manages permissions in Deployit.

HEAD | /security/check/{permission}/{id:.*?} | Deprecated - Use GET /security/check .
GET | /security/check/{permission}/{id:.*?} | Checks if the currently logged in user has a certain permission on a CI.
GET | /security/granted-permissions | Gets all the permissions granted to the logged in user.
GET | /security/granted-permissions/{role} | Gets all the permissions granted to a role.
GET | /security/permission/{permission}/{role}/{id:.*?} | Checks if a permission is granted to a role on a CI.
PUT | /security/permission/{permission}/{role}/{id:.*?} | Grants a permission to a role on a CI.
DELETE | /security/permission/{permission}/{role}/{id:.*?} | Revokes the permission of a role on a CI.

## HEAD /security/check/{permission}/{id:.*?}

Deprecated - Use GET /security/check . Checks if the currently logged in user has a certain permission on a CI. If the user does not have this permission, error code `403` is returned.

Parameters

  Path | permission | String | the name of the permission to check.
  Path | id | String | the path of the CI to check the permission on.

Response body
  Empty

## GET /security/check/{permission}/{id:.*?}

Checks if the currently logged in user has a certain permission on a CI.

Parameters

  Path | permission | String | the name of the permission to check.
  Path | id | String | the path of the CI to check the permission on.

Response body
  boolean - `true` if the user has this permission; `false` otherwise.
  Content type: application/xml, application/json

## GET /security/granted-permissions

Gets all the permissions granted to the logged in user.

Response body
  Map of String, Collection - a Map of configuration item ids to permissions granted the currently logged in user.
  Content type: application/xml, application/json

## GET /security/granted-permissions/{role}

Gets all the permissions granted to a role.

Permissions
  `security#edit`

Parameters

  Path | role | String | the role to get the permissions for.

Response body
  Map of String, Collection - a Map of configuration item ids to permissions granted to the user.
  Content type: application/xml, application/json

## GET /security/permission/{permission}/{role}/{id:.*?}

Checks if a permission is granted to a role on a CI.

Permissions
  `security#edit`

Parameters

  Path | permission | String | the name of the permission to check.
  Path | id | String | the path of the CI to check the permission on.
  Path | role | String | the role to which the permission should be granted.

Response body
  boolean - `true` if granted.
  Content type: application/xml, application/json

## PUT /security/permission/{permission}/{role}/{id:.*?}

Grants a permission to a role on a CI.

Permissions
  `security#edit`

Parameters

  Path | permission | String | the name of the permission to grant.
  Path | id | String | the path of the CI to grant the permission on.
  Path | role | String | the role to which the permission should be granted.

Response body
  Empty

## DELETE /security/permission/{permission}/{role}/{id:.*?}

Revokes the permission of a role on a CI.

Permissions
  `security#edit`

Parameters

  Path | permission | String | the name of the permission to revoke.
  Path | id | String | the path of the CI to revoke the permission from.
  Path | role | String | the role from which the permission should be revoked.

Response body
  Empty