mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-02 23:56:56 +08:00
Allowed creating pages in visible chapters in invisible books
Fixes permissions with test to cover in the event a page is created, with permission, in a chapter but the user does not have permission to see the parent book. Fixes #912
This commit is contained in:
@ -592,4 +592,26 @@ class RestrictionsTest extends BrowserKitTest
|
||||
->see('You do not have permission')
|
||||
->seePageIs('/');
|
||||
}
|
||||
|
||||
public function test_can_create_page_if_chapter_has_permissions_when_book_not_visible()
|
||||
{
|
||||
$book = Book::first();
|
||||
$this->setEntityRestrictions($book, []);
|
||||
$bookChapter = $book->chapters->first();
|
||||
$this->setEntityRestrictions($bookChapter, ['view']);
|
||||
|
||||
$this->actingAs($this->user)->visit($bookChapter->getUrl())
|
||||
->dontSee('New Page');
|
||||
|
||||
$this->setEntityRestrictions($bookChapter, ['view', 'create']);
|
||||
|
||||
$this->actingAs($this->user)->visit($bookChapter->getUrl())
|
||||
->click('New Page')
|
||||
->seeStatusCode(200)
|
||||
->type('test page', 'name')
|
||||
->type('test content', 'html')
|
||||
->press('Save Page')
|
||||
->seePageIs($book->getUrl('/page/test-page'))
|
||||
->seeStatusCode(200);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user