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; namespace Icinga\Controllers;
use Icinga\Application\Config;
use Icinga\Authentication\RolesConfig; use Icinga\Authentication\RolesConfig;
use Icinga\Exception\NotFoundError; use Icinga\Exception\NotFoundError;
use Icinga\Forms\Security\RoleForm; use Icinga\Forms\Security\RoleForm;
@ -32,7 +31,20 @@ class RoleController extends AuthBackendController
{ {
$this->assertPermission('config/authentication/roles/show'); $this->assertPermission('config/authentication/roles/show');
$this->createListTabs()->activate('role/list'); $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 ?> <?= $tabs ?>
<?= $this->paginator ?>
<div class="sort-controls-container">
<?= $this->limiter ?>
<?= $this->sortBox ?>
</div>
<?= $this->filterEditor ?>
</div> </div>
<div class="content"> <div class="content">
<?= $this->qlink( <?= $this->qlink(
@ -13,7 +19,7 @@
'title' => $this->translate('Create a new role') '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> <p><?= $this->translate('No roles found.') ?></p>
<?php return; endif ?> <?php return; endif ?>
<table class="table-row-selectable common-table" data-base-target="_next"> <table class="table-row-selectable common-table" data-base-target="_next">