X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/98b59a10249afeccbf25bdd5eadf35f43a19cf67..refs/pull/3830/head:/app/Http/Controllers/RoleController.php diff --git a/app/Http/Controllers/RoleController.php b/app/Http/Controllers/RoleController.php index d022bf35d..a9be19e0c 100644 --- a/app/Http/Controllers/RoleController.php +++ b/app/Http/Controllers/RoleController.php @@ -3,9 +3,10 @@ namespace BookStack\Http\Controllers; use BookStack\Auth\Permissions\PermissionsRepo; -use BookStack\Auth\Queries\AllRolesPaginatedAndSorted; +use BookStack\Auth\Queries\RolesAllPaginatedAndSorted; use BookStack\Auth\Role; use BookStack\Exceptions\PermissionsException; +use BookStack\Util\SimpleListOptions; use Exception; use Illuminate\Http\Request; use Illuminate\Validation\ValidationException; @@ -26,20 +27,22 @@ class RoleController extends Controller { $this->checkPermission('user-roles-manage'); - $listDetails = [ - 'search' => $request->get('search', ''), - 'sort' => setting()->getForCurrentUser('roles_sort', 'display_name'), - 'order' => setting()->getForCurrentUser('roles_sort_order', 'asc'), - ]; + $listOptions = SimpleListOptions::fromRequest($request, 'roles')->withSortOptions([ + 'display_name' => trans('common.sort_name'), + 'users_count' => trans('settings.roles_assigned_users'), + 'permissions_count' => trans('settings.roles_permissions_provided'), + 'created_at' => trans('common.sort_created_at'), + 'updated_at' => trans('common.sort_updated_at'), + ]); - $roles = (new AllRolesPaginatedAndSorted())->run(20, $listDetails); - $roles->appends(['search' => $listDetails['search']]); + $roles = (new RolesAllPaginatedAndSorted())->run(20, $listOptions); + $roles->appends($listOptions->getPaginationAppends()); $this->setPageTitle(trans('settings.roles')); return view('settings.roles.index', [ 'roles' => $roles, - 'listDetails' => $listDetails, + 'listOptions' => $listOptions, ]); }