mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
parent
fac2ebce80
commit
0686bc1d86
@ -7,6 +7,7 @@ use Icinga\Application\Config;
|
|||||||
use Icinga\Application\Logger;
|
use Icinga\Application\Logger;
|
||||||
use Icinga\Authentication\UserGroup\UserGroupBackend;
|
use Icinga\Authentication\UserGroup\UserGroupBackend;
|
||||||
use Icinga\Authentication\UserGroup\UserGroupBackendInterface;
|
use Icinga\Authentication\UserGroup\UserGroupBackendInterface;
|
||||||
|
use Icinga\Data\Reducible;
|
||||||
use Icinga\Forms\Config\UserGroupForm;
|
use Icinga\Forms\Config\UserGroupForm;
|
||||||
use Icinga\Web\Controller;
|
use Icinga\Web\Controller;
|
||||||
use Icinga\Web\Form;
|
use Icinga\Web\Form;
|
||||||
@ -114,8 +115,52 @@ class GroupController extends Controller
|
|||||||
$this->httpNotFound(sprintf($this->translate('Group "%s" not found'), $groupName));
|
$this->httpNotFound(sprintf($this->translate('Group "%s" not found'), $groupName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$members = $backend
|
||||||
|
->select()
|
||||||
|
->from('group_membership', array('user_name'))
|
||||||
|
->where('group_name', $groupName);
|
||||||
|
|
||||||
|
$filterEditor = Widget::create('filterEditor')
|
||||||
|
->setQuery($members)
|
||||||
|
->preserveParams('limit', 'sort', 'dir', 'view', 'backend', 'group')
|
||||||
|
->ignoreParams('page')
|
||||||
|
->handleRequest($this->getRequest());
|
||||||
|
$members->applyFilter($filterEditor->getFilter());
|
||||||
|
|
||||||
|
$this->setupFilterControl($filterEditor);
|
||||||
|
$this->setupPaginationControl($members);
|
||||||
|
$this->setupLimitControl();
|
||||||
|
$this->setupSortControl(
|
||||||
|
array(
|
||||||
|
'user_name' => $this->translate('Username'),
|
||||||
|
'created_at' => $this->translate('Created at'),
|
||||||
|
'last_modified' => $this->translate('Last modified')
|
||||||
|
),
|
||||||
|
$members
|
||||||
|
);
|
||||||
|
|
||||||
$this->view->group = $group;
|
$this->view->group = $group;
|
||||||
$this->view->backend = $backend;
|
$this->view->backend = $backend;
|
||||||
|
$this->view->members = $members;
|
||||||
|
|
||||||
|
if ($backend instanceof Reducible) {
|
||||||
|
$removeForm = new Form();
|
||||||
|
$removeForm->setName('removemember');
|
||||||
|
$removeForm->setAction(
|
||||||
|
Url::fromPath('group/removemember', array('backend' => $backend->getName(), 'group' => $groupName))
|
||||||
|
);
|
||||||
|
$removeForm->addElement('hidden', 'user_name', array('decorators' => array('ViewHelper')));
|
||||||
|
$removeForm->addElement('button', 'btn_submit', array(
|
||||||
|
'escape' => false,
|
||||||
|
'type' => 'submit',
|
||||||
|
'class' => 'link-like',
|
||||||
|
'value' => 'btn_submit',
|
||||||
|
'decorators' => array('ViewHelper'),
|
||||||
|
'label' => $this->view->icon('trash'),
|
||||||
|
'title' => $this->translate('Remove this member')
|
||||||
|
));
|
||||||
|
$this->view->removeForm = $removeForm;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Icinga\Data\Extensible;
|
||||||
use Icinga\Data\Updatable;
|
use Icinga\Data\Updatable;
|
||||||
|
|
||||||
|
$extensible = $backend instanceof Extensible;
|
||||||
|
|
||||||
$editLink = null;
|
$editLink = null;
|
||||||
if ($backend instanceof Updatable) {
|
if ($backend instanceof Updatable) {
|
||||||
$editLink = $this->qlink(
|
$editLink = $this->qlink(
|
||||||
@ -21,9 +24,9 @@ if ($backend instanceof Updatable) {
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<?php if (! $this->compact): ?>
|
<?php if (! $this->compact): ?>
|
||||||
<?= $tabs->showOnlyCloseButton(); ?>
|
<?= $tabs->showOnlyCloseButton(); ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<div class="group-header">
|
<div class="group-header">
|
||||||
<p class="group-name"><strong><?= $this->escape($group->group_name); ?></strong></p> <?= $editLink; ?>
|
<p class="group-name"><strong><?= $this->escape($group->group_name); ?></strong></p> <?= $editLink; ?>
|
||||||
<p class="group-parent"><strong><?= $this->translate('Parent'); ?>:</strong> <?= $group->parent_name === null ? '-' : $this->qlink(
|
<p class="group-parent"><strong><?= $this->translate('Parent'); ?>:</strong> <?= $group->parent_name === null ? '-' : $this->qlink(
|
||||||
@ -40,6 +43,50 @@ if ($backend instanceof Updatable) {
|
|||||||
<p class="group-created"><strong><?= $this->translate('Created at'); ?>:</strong> <?= $group->created_at === null ? '-' : $this->formatDateTime($group->created_at); ?></p>
|
<p class="group-created"><strong><?= $this->translate('Created at'); ?>:</strong> <?= $group->created_at === null ? '-' : $this->formatDateTime($group->created_at); ?></p>
|
||||||
<p class="group-modified"><strong><?= $this->translate('Last modified'); ?>:</strong> <?= $group->last_modified === null ? '-' : $this->formatDateTime($group->last_modified); ?></p>
|
<p class="group-modified"><strong><?= $this->translate('Last modified'); ?>:</strong> <?= $group->last_modified === null ? '-' : $this->formatDateTime($group->last_modified); ?></p>
|
||||||
</div>
|
</div>
|
||||||
|
<?php if (! $this->compact): ?>
|
||||||
|
<?= $this->sortBox; ?>
|
||||||
|
<?php endif ?>
|
||||||
|
<?= $this->limiter; ?>
|
||||||
|
<?= $this->paginator; ?>
|
||||||
|
<?php if (! $this->compact): ?>
|
||||||
|
<?= $this->filterEditor; ?>
|
||||||
|
<?php endif ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="content" data-base-target="_next">
|
<div class="content members" data-base-target="_next">
|
||||||
|
<?php if (count($members) > 0): ?>
|
||||||
|
<table data-base-target="_next" class="action member-list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="member-name"><?= $this->translate('Username'); ?></th>
|
||||||
|
<?php if (isset($removeForm)): ?>
|
||||||
|
<th class="member-remove"><?= $this->translate('Remove'); ?></th>
|
||||||
|
<?php endif ?>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($members as $member): ?>
|
||||||
|
<tr>
|
||||||
|
<td class="member-name"><?= $this->escape($member->user_name); ?></td>
|
||||||
|
<?php if (isset($removeForm)): ?>
|
||||||
|
<td class="member-remove">
|
||||||
|
<?php $removeForm->getElement('user_name')->setValue($member->user_name); echo $removeForm; ?>
|
||||||
|
</td>
|
||||||
|
<?php endif ?>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<?php else: ?>
|
||||||
|
<p><?= $this->translate('No group member found matching the filter'); ?></p>
|
||||||
|
<?php endif ?>
|
||||||
|
<?php if ($extensible): ?>
|
||||||
|
<?= $this->qlink($this->translate('Add a new member'), 'group/addmember', array(
|
||||||
|
'backend' => $backend->getName(),
|
||||||
|
'group' => $group->group_name
|
||||||
|
), array(
|
||||||
|
'icon' => 'plus',
|
||||||
|
'data-base-target' => '_next',
|
||||||
|
'class' => 'member-add'
|
||||||
|
)); ?>
|
||||||
|
<?php endif ?>
|
||||||
</div>
|
</div>
|
@ -266,6 +266,7 @@ div.content.groups {
|
|||||||
|
|
||||||
div.controls div.group-header {
|
div.controls div.group-header {
|
||||||
border-bottom: 2px solid @colorPetrol;
|
border-bottom: 2px solid @colorPetrol;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
|
||||||
.group-name {
|
.group-name {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@ -279,6 +280,33 @@ div.controls div.group-header {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.content.members {
|
||||||
|
table.member-list {
|
||||||
|
th.member-remove {
|
||||||
|
width: 8em;
|
||||||
|
padding-right: 0.5em;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.member-remove {
|
||||||
|
text-align: right;
|
||||||
|
|
||||||
|
form button.link-like {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.member-add {
|
||||||
|
display: block;
|
||||||
|
margin-top: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
form.backend-selection {
|
form.backend-selection {
|
||||||
float: right;
|
float: right;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user