mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-23 11:22:33 +01:00
Added content-perms API examples and docs tweaks
This commit is contained in:
parent
0de7530059
commit
1903924829
@ -54,13 +54,13 @@ class ContentPermissionsController extends ApiController
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the configured content-level permissions for the item of the given type and ID.
|
||||
* Update the configured content-level permission overrides for the item of the given type and ID.
|
||||
* 'contentType' should be one of: page, book, chapter, bookshelf.
|
||||
* 'contentId' should be the relevant ID of that item type you'd like to handle permissions for.
|
||||
* Providing an empty `role_permissions` array will remove any existing configured role permissions,
|
||||
* so you may want to fetch existing permissions beforehand if just adding/removing a single item.
|
||||
* You should completely omit the `owner_id`, `role_permissions` and/or the `fallback_permissions` properties
|
||||
* if you don't wish to update details within those categories.
|
||||
* from your request data if you don't wish to update details within those categories.
|
||||
*/
|
||||
public function update(Request $request, string $contentType, string $contentId)
|
||||
{
|
||||
|
26
dev/api/requests/content-permissions-update.json
Normal file
26
dev/api/requests/content-permissions-update.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"owner_id": 1,
|
||||
"role_permissions": [
|
||||
{
|
||||
"role_id": 2,
|
||||
"view": true,
|
||||
"create": true,
|
||||
"update": true,
|
||||
"delete": false
|
||||
},
|
||||
{
|
||||
"role_id": 3,
|
||||
"view": false,
|
||||
"create": false,
|
||||
"update": false,
|
||||
"delete": false
|
||||
}
|
||||
],
|
||||
"fallback_permissions": {
|
||||
"inheriting": false,
|
||||
"view": true,
|
||||
"create": true,
|
||||
"update": false,
|
||||
"delete": false
|
||||
}
|
||||
}
|
38
dev/api/responses/content-permissions-read.json
Normal file
38
dev/api/responses/content-permissions-read.json
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"owner": {
|
||||
"id": 1,
|
||||
"name": "Admin",
|
||||
"slug": "admin"
|
||||
},
|
||||
"role_permissions": [
|
||||
{
|
||||
"role_id": 2,
|
||||
"view": true,
|
||||
"create": false,
|
||||
"update": true,
|
||||
"delete": false,
|
||||
"role": {
|
||||
"id": 2,
|
||||
"display_name": "Editor"
|
||||
}
|
||||
},
|
||||
{
|
||||
"role_id": 10,
|
||||
"view": true,
|
||||
"create": true,
|
||||
"update": false,
|
||||
"delete": false,
|
||||
"role": {
|
||||
"id": 10,
|
||||
"display_name": "Wizards of the west"
|
||||
}
|
||||
}
|
||||
],
|
||||
"fallback_permissions": {
|
||||
"inheriting": false,
|
||||
"view": true,
|
||||
"create": false,
|
||||
"update": false,
|
||||
"delete": false
|
||||
}
|
||||
}
|
38
dev/api/responses/content-permissions-update.json
Normal file
38
dev/api/responses/content-permissions-update.json
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"owner": {
|
||||
"id": 1,
|
||||
"name": "Admin",
|
||||
"slug": "admin"
|
||||
},
|
||||
"role_permissions": [
|
||||
{
|
||||
"role_id": 2,
|
||||
"view": true,
|
||||
"create": true,
|
||||
"update": true,
|
||||
"delete": false,
|
||||
"role": {
|
||||
"id": 2,
|
||||
"display_name": "Editor"
|
||||
}
|
||||
},
|
||||
{
|
||||
"role_id": 3,
|
||||
"view": false,
|
||||
"create": false,
|
||||
"update": false,
|
||||
"delete": false,
|
||||
"role": {
|
||||
"id": 3,
|
||||
"display_name": "Viewer"
|
||||
}
|
||||
}
|
||||
],
|
||||
"fallback_permissions": {
|
||||
"inheriting": false,
|
||||
"view": true,
|
||||
"create": true,
|
||||
"update": false,
|
||||
"delete": false
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user