Resource: Project User Permissions ( /api/user/{userId}/permissions/project/{projectId} )

Project User Permissions resource - allows the retrieval of the collection of permissions directly associated with a user for a project, or updating the permissions associated with a project user.

Methods

GET


Retrieves the project permissions for this user

Required Permissions

  • Administration/Organisation/ManageUserAndGroupSecurity

Status Codes

These are the expected status codes returned by the service - in addition, some other status codes may be returned if either an internal error occurs or there is an authentication issue (such as an expired OAuth token).

StatusDescription
200 - OKReturned if the request was completed successfully.
404 - NotFoundReturned if the user does not exist.

Example - Retrieve Permissions

Retrieve the permissions assigned to this user for selected project.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
{userId}3a31a68a-9e51-4d87-91bb-aca0fa5c1fe9Unique ID of the user to retrieve permissions for
{projectId}9ee7ac7b-1fa9-4af6-91f2-cc59408b84d7Unique ID of the project to retrieve permissions for

Response Headers

KeyValueDescription
Content-Typeapplication/json; charset=utf-8

Response Body

[
  {
    "Id": "e6a7d6d3-6b16-4e94-a768-54bdd8bb3b22",
    "Key": "/Administration",
    "Links": [
      {
        "Href": "http://localhost/api/permission/e6a7d6d3-6b16-4e94-a768-54bdd8bb3b22",
        "Rel": "Permission"
      }
    ]
  },
  {
    "Id": "fad12035-4937-401a-881a-ea340050218e",
    "Key": "/Resources",
    "Links": [
      {
        "Href": "http://localhost/api/permission/fad12035-4937-401a-881a-ea340050218e",
        "Rel": "Permission"
      }
    ]
  }
]

Status Code

200 - OK

PUT


Sets the project permissions for this user

Required Permissions

  • Administration/Organisation/ManageUserAndGroupSecurity

Status Codes

These are the expected status codes returned by the service - in addition, some other status codes may be returned if either an internal error occurs or there is an authentication issue (such as an expired OAuth token).

StatusDescription
200 - OKReturned if the request was completed successfully.
403 - ForbiddenReturned if one or more permissions could not be resolved.
404 - NotFoundReturned if the user or project does not exist.

Example - Set Permissions (by Permission ID)

Set the permissions to grant to the user for this project (using the ID for each permission).

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
{userId}3a31a68a-9e51-4d87-91bb-aca0fa5c1fe9Unique ID of the user to set project permissions for
{projectId}9ee7ac7b-1fa9-4af6-91f2-cc59408b84d7Unique ID of the project to set user permissions for

Request Body

[
  {
    "Key": null,
    "Id": "e6a7d6d3-6b16-4e94-a768-54bdd8bb3b22"
  },
  {
    "Key": null,
    "Id": "fad12035-4937-401a-881a-ea340050218e"
  }
]

Response Headers

KeyValueDescription
Content-Typeapplication/json; charset=utf-8

Response Body

[
  {
    "Id": "e6a7d6d3-6b16-4e94-a768-54bdd8bb3b22",
    "Key": "/Administration",
    "Links": [
      {
        "Href": "http://localhost/api/permission/e6a7d6d3-6b16-4e94-a768-54bdd8bb3b22",
        "Rel": "Permission"
      }
    ]
  },
  {
    "Id": "fad12035-4937-401a-881a-ea340050218e",
    "Key": "/Resources",
    "Links": [
      {
        "Href": "http://localhost/api/permission/fad12035-4937-401a-881a-ea340050218e",
        "Rel": "Permission"
      }
    ]
  }
]

Status Code

200 - OK

Example - Set Permissions (by Key)

Set the permissions to grant to the user for this project (using the unique Key for each permission).

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
{userId}3a31a68a-9e51-4d87-91bb-aca0fa5c1fe9Unique ID of the user to set project permissions for
{projectId}9ee7ac7b-1fa9-4af6-91f2-cc59408b84d7Unique ID of the project to set user permissions for

Request Body

[
  {
    "Key": "/Administration",
    "Id": null
  },
  {
    "Key": "/Resources",
    "Id": null
  }
]

Response Headers

KeyValueDescription
Content-Typeapplication/json; charset=utf-8

Response Body

[
  {
    "Id": "e6a7d6d3-6b16-4e94-a768-54bdd8bb3b22",
    "Key": "/Administration",
    "Links": [
      {
        "Href": "http://localhost/api/permission/e6a7d6d3-6b16-4e94-a768-54bdd8bb3b22",
        "Rel": "Permission"
      }
    ]
  },
  {
    "Id": "fad12035-4937-401a-881a-ea340050218e",
    "Key": "/Resources",
    "Links": [
      {
        "Href": "http://localhost/api/permission/fad12035-4937-401a-881a-ea340050218e",
        "Rel": "Permission"
      }
    ]
  }
]

Status Code

200 - OK

  • No labels