]> BookStack Code Mirror - bookstack/commitdiff
Added notice for lack of shelf permission cascade
authorDan Brown <redacted>
Sat, 28 Aug 2021 14:44:44 +0000 (15:44 +0100)
committerDan Brown <redacted>
Sat, 28 Aug 2021 14:44:44 +0000 (15:44 +0100)
Closes #2876

resources/lang/en/entities.php
resources/views/form/entity-permissions.blade.php
resources/views/shelves/permissions.blade.php
tests/Entity/BookShelfTest.php

index 1d4632bce352c632bbb066cfd36fbfac953db7da..1be9c18e041818ad34df7c6bcc06563bf272f708 100644 (file)
@@ -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.',
index 178046ba2610bb79ec5e4677d50f5a7808b7e71f..ed04bc04124c9c0302568b8b4135390ce1314289 100644 (file)
         </div>
     </div>
 
+    @if($model instanceof \BookStack\Entities\Models\Bookshelf)
+        <p class="text-warn">{{ trans('entities.shelves_permissions_cascade_warning') }}</p>
+    @endif
+
     <hr>
 
     <table permissions-table class="table permissions-table toggle-switch-list" style="{{ !$model->restricted ? 'display: none' : '' }}">
index 7e5396488d0adfb6108e731234a66965746d2dd1..a26325518d6ac5294c38c1a89e5c7a1fdeb117c0 100644 (file)
@@ -14,7 +14,7 @@
             ]])
         </div>
 
-        <div class="card content-wrap">
+        <div class="card content-wrap auto-height">
             <h1 class="list-heading">{{ trans('entities.shelves_permissions') }}</h1>
             @include('form.entity-permissions', ['model' => $shelf])
         </div>
index cc9a7e44ea2a3c247022bfb49fd9789376cc08d8..480d290028153ef1f7e789924f76da2da604dc7f 100644 (file)
@@ -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();