Beanstalk

Permission Resource

This resource contains information about permissions for each user that includes: read/write repository access and access to deployments.

Readable attributes

id integer Unique ID of the Permission.
repository_id integer ID of the Repository to which permissions are granted.
user_id integer ID of the User to whom permissions have been granted.
server_environment_id integer

ID of ServerEnvironment to which User should have access.

If specified, allows user to create and retry deployments.

Does not allow viewing incidents or changing any deployments settings.

Can not be set together with full_deployments_acccess. Automatically sets read to true.

full_deployments_access boolean

True if allow full access to Repository’s deployments.

Includes: managing environments and servers; viewing incidents; creating and retrying deployments.

Automatically sets read to true.

deploy_only_access boolean True if allow user to view repository’s deployments activity and issue deployments.
read boolean True if allow read-access to Repository.
write boolean True if allow read and write access to Repository.

Writable attributes

When setting permissions for Deployments you only have to specify one of the attributes: server_environment_id, full_deployments_access or deploy_only_access.

repository_id integer Required on create.
user_id integer Required on create.
deploy_only_access boolean Optional.
server_environment_id integer Optional. Overwrites deploy_only_access.
full_deployments_access boolean Optional. Overwrites server_environment_id and deploy_only_access.
read boolean Optional.
write boolean Optional.

Find Permissions

Admins can view permissions for any user of the account. Regular users can find their permissions only.

json http-request
GET /api/permissions/{USER_ID}.json

Click to expand…

json http-response
[
  {
    "permission": {
      "read": true,
      "server_environment_id": null,
      "id": 3,
      "user_id": 7,
      "write": true,
      "repository_id": 3,
      "full_deployments_access": false
    }
  }
]
xml http-request
GET /api/permissions/{USER_ID}.xml

Click to expand…

xml http-response
<?xml version="1.0" encoding="UTF-8"?>
<permissions type="array">
  <permission>
    <id type="integer">9732462</id>
    <user-id type="integer">259</user-id>
    <repository-id type="integer">22</repository-id>
    <read type="boolean">true</read>
    <write type="boolean">true</write>
    <full-deployments-access type="boolean">false</full-deployments-access>
    <server-environment-id type="integer" nil="true"></server-environment-id>
  </permission>
</permissions>

Create Permissions

Admin privileges required for this API method.

With this method you can specify user’s permissions for a specific repository.

You can specify as many or as little attributes as you need. This method will reset any existing permissions user might have before creating new ones.

json http-request
POST /api/permissions.json
{
  "permission": {
    "user_id": 324324,
    "repository_id": 34324,
    "write": true,
    "server_environment_id": 3434
  }
}

Click to expand…

json http-response
{
  "permission": {
    "read": true,
    "server_environment_id": null,
    "id": 3,
    "user_id": 7,
    "write": true,
    "repository_id": 3,
    "full_deployments_access": false
  }
}
xml http-request
POST /api/permissions.xml
<?xml version="1.0" encoding="UTF-8"?>
<permission>
  <user-id type="integer">5638</user-id>
  <repository-id type="integer">11</repository-id>
  <write type="boolean">true</write>
  <server-environment-id type="integer">362</server-environment-id>
</permission>

Click to expand…

xml http-response
<?xml version="1.0" encoding="UTF-8"?>
<permission>
  <id type="integer">9732462</id>
  <user-id type="integer">5638</user-id>
  <repository-id type="integer">11</repository-id>
  <read type="boolean">true</read>
  <write type="boolean">true</write>
  <full-deployments-access type="boolean">false</full-deployments-access>
  <server-environment-id type="integer">362</server-environment-id>
</permission>

Delete Permission

Admin privileges required for this API method.

This method allows you to remove any permissions for a specified user in a specified repository.

json http-request
DELETE /api/permissions/{PERMISSION_ID}.json

Click to expand…

json http-response
HEAD OK
  
--OR IF INVALID--

{
  "errors": ["Name can't be blank"]
}
xml http-request
DELETE /api/permissions/{PERMISSION_ID}.xml

Click to expand…

xml http-response
HEAD OK
  
--OR IF INVALID--

<?xml version="1.0" encoding="UTF-8"?>
<errors>
  <error>Delete failed. Please try again later.</error>
</errors>