mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-28 17:02:04 +03:00
Added interface for adding/removing roles in entity perms.
This commit is contained in:
@ -2,7 +2,9 @@
|
||||
|
||||
namespace BookStack\Http\Controllers;
|
||||
|
||||
use BookStack\Auth\Permissions\EntityPermission;
|
||||
use BookStack\Auth\Permissions\PermissionFormData;
|
||||
use BookStack\Auth\Role;
|
||||
use BookStack\Entities\Models\Book;
|
||||
use BookStack\Entities\Models\Bookshelf;
|
||||
use BookStack\Entities\Models\Chapter;
|
||||
@ -148,4 +150,20 @@ class PermissionsController extends Controller
|
||||
|
||||
return redirect($shelf->getUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an empty entity permissions form row for the given role.
|
||||
*/
|
||||
public function formRowForRole(string $entityType, string $roleId)
|
||||
{
|
||||
$this->checkPermissionOr('restrictions-manage', fn() => userCan('restrictions-manage-all'));
|
||||
|
||||
$role = Role::query()->findOrFail($roleId);
|
||||
|
||||
return view('form.entity-permissions-row', [
|
||||
'role' => $role,
|
||||
'permission' => new EntityPermission(),
|
||||
'entityType' => $entityType,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user