Add controls to the roles list

This commit is contained in:
Eric Lippmann 2020-03-10 09:58:49 +01:00
parent 2f1716a8c9
commit 63514eeeb7
2 changed files with 22 additions and 4 deletions

View File

@ -3,7 +3,6 @@
namespace Icinga\Controllers;
use Icinga\Application\Config;
use Icinga\Authentication\RolesConfig;
use Icinga\Exception\NotFoundError;
use Icinga\Forms\Security\RoleForm;
@ -32,7 +31,20 @@ class RoleController extends AuthBackendController
{
$this->assertPermission('config/authentication/roles/show');
$this->createListTabs()->activate('role/list');
$this->view->roles = Config::app('roles', true);
$this->view->roles = (new RolesConfig())
->select();
$sortAndFilterColumns = [
'name' => $this->translate('Name'),
'users' => $this->translate('Users'),
'groups' => $this->translate('Groups'),
'permissions' => $this->translate('Permissions')
];
$this->setupFilterControl($this->view->roles, $sortAndFilterColumns, ['name']);
$this->setupLimitControl();
$this->setupPaginationControl($this->view->roles);
$this->setupSortControl($sortAndFilterColumns, $this->view->roles, ['name']);
}
/**

View File

@ -1,5 +1,11 @@
<div class="controls">
<div class="controls separated">
<?= $tabs ?>
<?= $this->paginator ?>
<div class="sort-controls-container">
<?= $this->limiter ?>
<?= $this->sortBox ?>
</div>
<?= $this->filterEditor ?>
</div>
<div class="content">
<?= $this->qlink(
@ -13,7 +19,7 @@
'title' => $this->translate('Create a new role')
)
) ?>
<?php /** @var \Icinga\Application\Config $roles */ if ($roles->isEmpty()): ?>
<?php /** @var \Icinga\Application\Config $roles */ if (! $roles->hasResult()): ?>
<p><?= $this->translate('No roles found.') ?></p>
<?php return; endif ?>
<table class="table-row-selectable common-table" data-base-target="_next">