1
0
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:
Dan Brown
2022-10-10 12:24:23 +01:00
parent ffd6a1002e
commit 803934d020
7 changed files with 177 additions and 25 deletions

View File

@ -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,
]);
}
}