mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-08-06 12:02:45 +03:00
Copied over work from user_permissions branch
Only that relevant to the additional testing work.
This commit is contained in:
@@ -49,16 +49,16 @@ class ConvertTest extends TestCase
|
||||
public function test_convert_chapter_to_book_requires_permissions()
|
||||
{
|
||||
$chapter = $this->entities->chapter();
|
||||
$user = $this->getViewer();
|
||||
$user = $this->users->viewer();
|
||||
|
||||
$permissions = ['chapter-delete-all', 'book-create-all', 'chapter-update-all'];
|
||||
$this->giveUserPermissions($user, $permissions);
|
||||
$this->permissions->grantUserRolePermissions($user, $permissions);
|
||||
|
||||
foreach ($permissions as $permission) {
|
||||
$this->removePermissionFromUser($user, $permission);
|
||||
$this->permissions->removeUserRolePermissions($user, [$permission]);
|
||||
$resp = $this->actingAs($user)->post($chapter->getUrl('/convert-to-book'));
|
||||
$this->assertPermissionError($resp);
|
||||
$this->giveUserPermissions($user, [$permission]);
|
||||
$this->permissions->grantUserRolePermissions($user, [$permission]);
|
||||
}
|
||||
|
||||
$resp = $this->actingAs($user)->post($chapter->getUrl('/convert-to-book'));
|
||||
@@ -122,16 +122,16 @@ class ConvertTest extends TestCase
|
||||
public function test_book_convert_to_shelf_requires_permissions()
|
||||
{
|
||||
$book = $this->entities->book();
|
||||
$user = $this->getViewer();
|
||||
$user = $this->users->viewer();
|
||||
|
||||
$permissions = ['book-delete-all', 'bookshelf-create-all', 'book-update-all', 'book-create-all'];
|
||||
$this->giveUserPermissions($user, $permissions);
|
||||
$this->permissions->grantUserRolePermissions($user, $permissions);
|
||||
|
||||
foreach ($permissions as $permission) {
|
||||
$this->removePermissionFromUser($user, $permission);
|
||||
$this->permissions->removeUserRolePermissions($user, [$permission]);
|
||||
$resp = $this->actingAs($user)->post($book->getUrl('/convert-to-shelf'));
|
||||
$this->assertPermissionError($resp);
|
||||
$this->giveUserPermissions($user, [$permission]);
|
||||
$this->permissions->grantUserRolePermissions($user, [$permission]);
|
||||
}
|
||||
|
||||
$resp = $this->actingAs($user)->post($book->getUrl('/convert-to-shelf'));
|
||||
|
Reference in New Issue
Block a user