1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-31 15:24:31 +03:00

Pages: Redirect user to view if they can't edit

For #5568
This commit is contained in:
Dan Brown
2025-05-24 12:05:17 +01:00
parent b29fe5c46d
commit 454b152b95
3 changed files with 17 additions and 6 deletions

View File

@ -356,4 +356,14 @@ class PageTest extends TestCase
$resp = $this->get('/');
$this->withHtml($resp)->assertElementContains('#recently-updated-pages', $page->name);
}
public function test_page_edit_without_update_permissions_but_with_view_redirects_to_page()
{
$page = $this->entities->page();
$resp = $this->asViewer()->get($page->getUrl('/edit'));
$resp->assertRedirect($page->getUrl());
$resp->assertSessionHas('error', 'You do not have permission to access the requested page.');
}
}