diff --git a/resources/lang/en/entities.php b/resources/lang/en/entities.php index 1d4632bce..1be9c18e0 100644 --- a/resources/lang/en/entities.php +++ b/resources/lang/en/entities.php @@ -99,6 +99,7 @@ return [ 'shelves_permissions' => 'Bookshelf Permissions', 'shelves_permissions_updated' => 'Bookshelf Permissions Updated', 'shelves_permissions_active' => 'Bookshelf Permissions Active', + 'shelves_permissions_cascade_warning' => 'Permissions on bookshelves do not automatically cascade to contained books. This is because a book can exist on multiple shelves. Permissions can however be copied down to child books using the option found below.', 'shelves_copy_permissions_to_books' => 'Copy Permissions to Books', 'shelves_copy_permissions' => 'Copy Permissions', 'shelves_copy_permissions_explain' => 'This will apply the current permission settings of this bookshelf to all books contained within. Before activating, ensure any changes to the permissions of this bookshelf have been saved.', diff --git a/resources/views/form/entity-permissions.blade.php b/resources/views/form/entity-permissions.blade.php index 178046ba2..ed04bc041 100644 --- a/resources/views/form/entity-permissions.blade.php +++ b/resources/views/form/entity-permissions.blade.php @@ -20,6 +20,10 @@ + @if($model instanceof \BookStack\Entities\Models\Bookshelf) +

{{ trans('entities.shelves_permissions_cascade_warning') }}

+ @endif +
diff --git a/resources/views/shelves/permissions.blade.php b/resources/views/shelves/permissions.blade.php index 7e5396488..a26325518 100644 --- a/resources/views/shelves/permissions.blade.php +++ b/resources/views/shelves/permissions.blade.php @@ -14,7 +14,7 @@ ]]) -
+

{{ trans('entities.shelves_permissions') }}

@include('form.entity-permissions', ['model' => $shelf])
diff --git a/tests/Entity/BookShelfTest.php b/tests/Entity/BookShelfTest.php index cc9a7e44e..480d29002 100644 --- a/tests/Entity/BookShelfTest.php +++ b/tests/Entity/BookShelfTest.php @@ -308,6 +308,13 @@ class BookShelfTest extends TestCase $this->assertDatabaseHas('entity_permissions', ['restrictable_id' => $child->id, 'action' => 'update', 'role_id' => $editorRole->id]); } + public function test_permission_page_has_a_warning_about_no_cascading() + { + $shelf = Bookshelf::first(); + $resp = $this->asAdmin()->get($shelf->getUrl('/permissions')); + $resp->assertSeeText('Permissions on bookshelves do not automatically cascade to contained books.'); + } + public function test_bookshelves_show_in_breadcrumbs_if_in_context() { $shelf = Bookshelf::first();