File Permissions
Use the File Permission API so that users can complete the following actions:
- Get, create, update, or delete resource permissions.
Users can perform these actions on other users' resources if they have SHARE permissions for that resource.
Note: When a user creates a resource, such as a file, they automatically receive all permissions for the resource.
Get Permissions#
Gets a file's permissions for a user or usergroup.
Endpoints#
GET /filesvc/api/v1/permissionsRequest#
Parameters#
Query#
| Parameter | Type | Description | Required |
|---|---|---|---|
_namespace | String | The namespace that contains the permission. | Required |
_resourceDesc | Object | Pass an object with an _irn property. | Required |
_resourceDesc._irn | String | In the _resourceDesc object, add an _irn property with the resource's path as its value. For the resource path, concetenate the service name, resource type, and resource's id with colons, for example, filesvc:file:6336c490017d84b0a506e453 for a file or filesvc:file:* for all files in the file service. | Required |
_user | Object | Pass an object with _id and _type properties. | Required |
_user._id | String | Pass the id of the user with permissions for the resource. If you do not pass an id, the logged in user's id is used. | Optional |
_user._type | String | If the permission is for a user, pass "user"; for a user group, pass "usergroup"; for permission profile pass "permprofile". | Required if you pass a _user object |
Response#
Codes#
| Code | Description |
|---|---|
200 | Success |
400 | Bad Request |
Body#
Code example
{ "_pageSize": 1, "_list": [ { "_actions": [ "READ" ], "_namespace": "wsDUser3_DYwgNJyT", "_irn": "filesvc:file:5ac6f43da7b11b0001ef4177", "_user": { "_type": "user", "_id": "ab38424d-69b2-4353-812e-78faac6ebd7a" }, "_id": "0d0c1064-5718-4cee-9779-b86db5f9ba0c" } ], "_offset": 0, "_total": 1, "_includeTotal": true}Create or Update Permissions#
Creates a file permission for a user or usergroup. If the file permission already exists, it updates with your new values.
Endpoints#
POST /filesvc/api/v1/permissionsParameters#
Body#
| Parameter | Type | Description | Required |
|---|---|---|---|
_resourceDesc | Object | resource descriptor for which the permission creates. | Required |
_resourceDesc._irn | String | In the _resourceDesc object, add an _irn property with the resource's path as its value. For the resource path, concetenate the service name, resource type, and resource's id with colons, for example, filesvc:file:6336c490017d84b0a506e453 for a file or filesvc:file:* for all files in the file service. | Required |
_resourceDesc._criteria | String | Pass a key-value pair. | Optional |
_namespace | String | The namespace that contains the permission. | Required |
_user | Object | Pass an object with _id and _type properties. | Required |
_user._id | String | Pass the id of the user with permissions for the resource. If you do not pass an id, the logged in user's id is used. | Optional |
_user._type | String | If the permission is for a user, pass "user"; for a user group, pass "usergroup"; for permission profile pass "permprofile" | Required if you pass a _user object |
_actions | Array of String | An array that contains the permissions you want to give the user for the resource, such as "READ", "CREATE", "EDIT", "DELETE", or "SHARE". To grant all permissions, pass "*". | Required |
Code example
[ { "_actions": [ "READ" ], "_namespace": "r_TmBKvZTI", "_resourceDesc": { "_irn": "filesvc:file:5ac6f43da7b11b0001ef4177", "_criteria": { "_userType": "iput_cde_admin" } }, "_user": { "_type": "user", "_id": "1f159053-657b-40f4-9897-434f9e2df8be" } }]Response#
Codes#
| Code | Description |
|---|---|
200 | Success |
400 | Bad Request |
Body#
Code example
{ "_success": [ { "_actions": [ "READ" ], "_namespace": "wsDUser3_DYwgNJyT", "_resourceDesc": { "_irn": "filesvc:file:5ac6f43da7b11b0001ef4177" }, "_user": { "_type": "user", "_id": "ab38424d-69b2-4353-812e-78faac6ebd7a" }, "_id": "0d0c1064-5718-4cee-9779-b86db5f9ba0c", "_status": 200 } ], "_failures": []}Delete Permission by Id#
Deletes a permission when you pass its id.
Endpoints#
DELETE /filesvc/api/v1/permissions/{id}Request#
Parameters#
Path#
| Parameter | Type | Description | Required |
|---|---|---|---|
id | String | Pass the permission's id. | Required |
Response#
Codes#
| Code | Description |
|---|---|
204 | No Content |
404 | Not found |