Assigning User Groups for Object Records Permission Set
POST /api/object-records/object_record_id/permission-sets/permission_set_id/assignees/user-groups/
Endpoint to create ObjectRecordAssigneeUserGroups model object. Batch operation - adds single or multiple user groups as assignees to specific permission set.
Permissions
Perm to check: object_records.edit_owners (for individual Object Record).
URL parameters
| Key | Notes |
|---|---|
| object_record_id | Object Record ID |
| permission_set_id | Permission Set ID |
Request Schema
- Headers
Request Method: POST
Location: /api/object-records/{object_record_id}/permission-sets/{permission_set_id}/assignees/user-groups/
Authorization: JWT access_token- Body
[<int>]Request body must contain a list of user group ids to be assigned.
[<group_id1>, <group_id2>]If some of user group is already an assignee for given permission set, then request should be silently accepted without an error or a warning.
created_atandcreated_byfields are set automatically if relation does not exist.
Request example
[2734, 7231]Response example
| Key | Type | Notes |
|---|---|---|
| id | pk | Automatically generated by the backend. |
| user_group | user_group | |
| created_at | datetime | |
| created_by | user |
- Status
201 CREATED - Body
[
{
"id": 1,
"user_group": {
"id": 100,
"name": "User Group 1"
},
"created_at": "2021-07-05T06:49:30.688714Z",
"created_by": {
"id": 5,
"first_name": "Ann",
"last_name": "Jackson",
"company_name": "Company2",
"username": "ann.jackson@mail.com",
"is_deleted": false
}
},
{
"id": 2,
"user_group": {
"id": 101,
"name": "User Group 2"
},
"created_at": "2021-07-05T06:49:30.688714Z",
"created_by": {
"id": 5,
"first_name": "Ann",
"last_name": "Jackson",
"company_name": "Company2",
"username": "ann.jackson@mail.com",
"is_deleted": false,
"account_type": "super_admin"
}
}
]Restriction
- Max
10user groups ids in one request - Max
10items of Object Class Assignees (per Object Class and Permission Set)
Errors
| Error | Response code | Message |
|---|---|---|
| Given empty list | 400 Bad Request | "detail": ["This list may not be empty."] |
| Given different type than list | 400 Bad Request | "detail": ["Expected a list of items but got type "{type}"."] |
| List contains item of wrong type | 400 Bad Request | "detail": ["Incorrect type. Expected pk value, received {type}."] |
| Users Group does not exist for given ID in list | 400 Bad Request | "detail": ["Invalid pk "{group_id}" - object does not exist."] |
| Attempt to assign assignees to the everyone or members perm set | 400 Bad Request | "detail": ["Assignees can not be set to this permission set type."] |
| More than 10 items in a list | 400 Bad Request | "detail": ["Up to 10 items allowed."] |
User has no list group permission for the group that was passed. | 400 Bad Request | "detail": ["Invalid pk "{group_id}" - You do not have permission for this Group."] |
| Limit of Assignees for Object Class and Permission Set exceeded. | 400 Bad Request | "detail": "Limit of 10 permission set assignees has been exceeded.", "error_code": "ERR_LIMIT_EXCEEDED" |
Wrong/not existing permission_set_id | 404 Not Found | |
Wrong/not existing object_record_id | 404 Not Found | |
| Insufficient permissions | 403 Forbidden | "detail": "You do not have permission to perform this action." |
OPTIONS /api/object-records/object_record_id/permission-sets/permission_set_id/assignees/user-groups/
Endpoint returns schema for POST and GET.
Permissions
Requires authentication only.
URL parameters
| Key | Notes |
|---|---|
| object_record_id | Object Record ID |
| permission_set_id | Permission Set ID |
Request schema
- Headers
Request Method: OPTIONS
Location: /api/object-records/`object_record_id`/permission-sets/`permission_set_id`/assignees/user-groups/Response example
- Status
200 OK - Body
{
"list": {
"columns": [
{
"alias": "id",
"type": "int",
"predicates": [],
"sort_ok": false
},
{
"alias": "user_group",
"type": "user_group",
"predicates": [],
"sort_ok": false
},
{
"alias": "created_by",
"type": "user",
"predicates": [],
"sort_ok": false
},
{
"alias": "created_at",
"type": "datetime",
"predicates": [],
"sort_ok": false
}
]
},
"batch": {
"type": "set",
"required": true,
"autocomplete": "/api/user-groups/autocomplete/?text__icontains="
},
"restrictions": {
"limit_items": 10,
"limit_items_in_batch": 10
}
}GET /api/object-records/object_record_id/permission-sets/permission_set_id/assignees/user-groups/
Endpoint to receive list of ObjectRecordAssigneeUserGroups model objects for defined Object Record and Permission Set.
Permissions
Perm to check: object_record.view.
URL parameters
| Key | Notes |
|---|---|
| object_record_id | Object Record ID |
| permission_set_id | Permission Set ID |
Request schema
- Headers
Request Method: GET
Location: /api/object-records/`object_record_id`/permission-sets/`permission_set_id`/assignees/user-groups/
Authorization: JWT access_tokenResponse
| Key | Type | Notes |
|---|---|---|
| limit | int | |
| offset | int | |
| total_count | int | Total number of assignees for specific permission set related to specific object record. |
| filtered_count | int | Number of assignees if some filters are applied. |
| next | URL / null | Next page URL (null if there is no next page) |
| previous | URL / null | Previous page URL (null if there is no previous page) |
| results | Array | Described in the next table. |
Response results array
| Key | Type | Notes |
|---|---|---|
| id | pk | Automatically generated by the backend. |
| user_group | user_group | |
| created_at | datetime | |
| created_by | user |
Response schema
- Status
200 OK - Body:
{
"limit": <int>,
"offset": <int>,
"filtered_count": <int>,
"total_count": <int>,
"next": <str|null>,
"previous": <str|null>,
"results": [
{
"id": <int>,
"user_group": <user_group>,
"created_at": <datetime>,
"created_by": <user>
}
]
}Response example
[
{
"id": 1,
"user_group": {
"id": 100,
"name": "User Group 1"
},
"created_at": "2021-07-05T06:49:30.688714Z",
"created_by": {
"id": 5,
"first_name": "Ann",
"last_name": "Jackson",
"company_name": "Company2",
"username": "ann.jackson@mail.com",
"is_deleted": false
}
}
]Sorting
Not available. Results are not sorted - order returned by database.
Filtering
No filters.
Errors
| Error | Response code | Message |
|---|---|---|
Object Class for object_record_id not found. | 404 Not Found | |
Permission set for permission_set_id not found (for given object_record_id). | 404 Not Found | |
| Insufficient permissions | 403 Forbidden | "detail": "You do not have permission to perform this action." |
DELETE /api/object-records/object_record_id/permission-sets/permission_set_id/assignees/user-groups/
Endpoint to remove ObjectRecordAssigneeUserGroups model objects. Batch operation - removes user groups (assignees) from a permission set.
Permissions
Perm to check: object_records.edit_owners (for individual Object Record).
URL parameters
| Key | Notes |
|---|---|
| object_record_id | Object Record ID |
| permission_set_id | Permission Set ID |
Request schema
- Headers
Request Method: DELETE
Location: /api/object-records/{object_record_id}/permission-sets/{permission_set_id}/assignees/user-groups/
Authorization: JWT access_token- Body
In body must be sent list of Object CRecord Assignees user groups ids.
[<group_id1>, <group_id2>]Response example
- Status
204 No Content
Restrictions
- Max
10user groups ids in one request
Errors
| Error | Response code | Message |
|---|---|---|
| Given empty list | 400 Bad Request | "detail": ["This list may not be empty."] |
| Given different type than list | 400 Bad Request | "detail": ["Expected a list of items but got type "{type}"."] |
| List contains item of wrong type | 400 Bad Request | "detail": ["Incorrect type. Expected pk value, received {type}."] |
| Assignee does not exist for given ID in list | 400 Bad Request | "detail": ["Invalid pk "{assignee_id}" - object does not exist."] |
| More than 10 items on a list | 400 Bad Request | "detail": ["Up to 10 items allowed."] |
Wrong/not existing permission_set_id | 404 Not Found | |
Wrong/not existing object_record_id | 404 Not Found | |
| Insufficient permissions | 403 Forbidden | "detail": "You do not have permission to perform this action." |