mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-28 17:02:04 +03:00
Guest control: Cleaned methods involved in fetching/handling
- Moves guest user caching from User class to app container for simplicity. - Updates test to use simpler $this->users->guest() method for consistency. - Streamlined helpers to avoid function overlap for simplicity. - Extracted user profile dropdown while doing changes.
This commit is contained in:
@ -103,7 +103,7 @@ class PublicActionTest extends TestCase
|
||||
$resp = $this->post($chapter->getUrl('/create-guest-page'), ['name' => 'My guest page']);
|
||||
$resp->assertRedirect($chapter->book->getUrl('/page/my-guest-page/edit'));
|
||||
|
||||
$user = User::getDefault();
|
||||
$user = $this->users->guest();
|
||||
$this->assertDatabaseHas('pages', [
|
||||
'name' => 'My guest page',
|
||||
'chapter_id' => $chapter->id,
|
||||
@ -197,7 +197,7 @@ class PublicActionTest extends TestCase
|
||||
public function test_public_view_can_take_on_other_roles()
|
||||
{
|
||||
$this->setSettings(['app-public' => 'true']);
|
||||
$newRole = $this->users->attachNewRole(User::getDefault(), []);
|
||||
$newRole = $this->users->attachNewRole($this->users->guest(), []);
|
||||
$page = $this->entities->page();
|
||||
$this->permissions->disableEntityInheritedPermissions($page);
|
||||
$this->permissions->addEntityPermission($page, ['view', 'update'], $newRole);
|
||||
|
Reference in New Issue
Block a user