mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-08-09 10:22:51 +03:00
Allowed child entity permissions to override parent permissions
Updated elements of a page display and sidebar render to allow child permissions to work even when parent entitites have permission set. This allows a page with a 'view' permission to be viewable even when the parent book or chapter is not viewable. Fixes #366
This commit is contained in:
@@ -522,4 +522,21 @@ class RestrictionsTest extends BrowserKitTest
|
||||
->see('Delete Chapter');
|
||||
}
|
||||
|
||||
public function test_page_visible_if_has_permissions_when_book_not_visible()
|
||||
{
|
||||
$book = \BookStack\Book::first();
|
||||
$bookChapter = $book->chapters->first();
|
||||
$bookPage = $bookChapter->pages->first();
|
||||
|
||||
$this->setEntityRestrictions($book, []);
|
||||
$this->setEntityRestrictions($bookPage, ['view']);
|
||||
|
||||
$this->actingAs($this->viewer);
|
||||
$this->get($bookPage->getUrl());
|
||||
$this->assertResponseOk();
|
||||
$this->see($bookPage->name);
|
||||
$this->dontSee(substr($book->name, 0, 15));
|
||||
$this->dontSee(substr($bookChapter->name, 0, 15));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user