GroupController: Apply permission config/application/groups/member/remove
refs #8826
This commit is contained in:
parent
1517c72be1
commit
d157dec13b
|
@ -130,7 +130,7 @@ class GroupController extends AuthBackendController
|
||||||
$this->view->members = $members;
|
$this->view->members = $members;
|
||||||
$this->createShowTabs($backend->getName(), $groupName)->activate('group/show');
|
$this->createShowTabs($backend->getName(), $groupName)->activate('group/show');
|
||||||
|
|
||||||
if ($this->hasPermission('config/application/groups/remove') && $backend instanceof Reducible) {
|
if ($this->hasPermission('config/application/groups/member/remove') && $backend instanceof Reducible) {
|
||||||
$removeForm = new Form();
|
$removeForm = new Form();
|
||||||
$removeForm->setUidDisabled();
|
$removeForm->setUidDisabled();
|
||||||
$removeForm->setAction(
|
$removeForm->setAction(
|
||||||
|
@ -255,6 +255,7 @@ class GroupController extends AuthBackendController
|
||||||
*/
|
*/
|
||||||
public function removememberAction()
|
public function removememberAction()
|
||||||
{
|
{
|
||||||
|
$this->assertPermission('config/application/groups/member/remove');
|
||||||
$this->assertHttpMethod('POST');
|
$this->assertHttpMethod('POST');
|
||||||
$groupName = $this->params->getRequired('group');
|
$groupName = $this->params->getRequired('group');
|
||||||
$backend = $this->getUserGroupBackend($this->params->getRequired('backend'), 'Icinga\Data\Reducible');
|
$backend = $this->getUserGroupBackend($this->params->getRequired('backend'), 'Icinga\Data\Reducible');
|
||||||
|
|
|
@ -132,30 +132,32 @@ class UserController extends AuthBackendController
|
||||||
$this->view->memberships = $memberships;
|
$this->view->memberships = $memberships;
|
||||||
$this->createShowTabs($backend->getName(), $userName)->activate('user/show');
|
$this->createShowTabs($backend->getName(), $userName)->activate('user/show');
|
||||||
|
|
||||||
$removeForm = new Form();
|
if ($this->hasPermission('config/application/groups/member/remove')) {
|
||||||
$removeForm->setUidDisabled();
|
$removeForm = new Form();
|
||||||
$removeForm->addElement('hidden', 'user_name', array(
|
$removeForm->setUidDisabled();
|
||||||
'isArray' => true,
|
$removeForm->addElement('hidden', 'user_name', array(
|
||||||
'value' => $userName,
|
'isArray' => true,
|
||||||
'decorators' => array('ViewHelper')
|
'value' => $userName,
|
||||||
));
|
'decorators' => array('ViewHelper')
|
||||||
$removeForm->addElement('hidden', 'redirect', array(
|
));
|
||||||
'value' => Url::fromPath('user/show', array(
|
$removeForm->addElement('hidden', 'redirect', array(
|
||||||
'backend' => $backend->getName(),
|
'value' => Url::fromPath('user/show', array(
|
||||||
'user' => $userName
|
'backend' => $backend->getName(),
|
||||||
)),
|
'user' => $userName
|
||||||
'decorators' => array('ViewHelper')
|
)),
|
||||||
));
|
'decorators' => array('ViewHelper')
|
||||||
$removeForm->addElement('button', 'btn_submit', array(
|
));
|
||||||
'escape' => false,
|
$removeForm->addElement('button', 'btn_submit', array(
|
||||||
'type' => 'submit',
|
'escape' => false,
|
||||||
'class' => 'link-like',
|
'type' => 'submit',
|
||||||
'value' => 'btn_submit',
|
'class' => 'link-like',
|
||||||
'decorators' => array('ViewHelper'),
|
'value' => 'btn_submit',
|
||||||
'label' => $this->view->icon('trash'),
|
'decorators' => array('ViewHelper'),
|
||||||
'title' => $this->translate('Cancel this membership')
|
'label' => $this->view->icon('trash'),
|
||||||
));
|
'title' => $this->translate('Cancel this membership')
|
||||||
$this->view->removeForm = $removeForm;
|
));
|
||||||
|
$this->view->removeForm = $removeForm;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -66,7 +66,7 @@ if ($this->hasPermission('config/application/users/edit') && $backend instanceof
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</td>
|
</td>
|
||||||
<td class="membership-cancel" data-base-target="_self">
|
<td class="membership-cancel" data-base-target="_self">
|
||||||
<?php if ($membership->backend instanceof Reducible): ?>
|
<?php if (isset($removeForm) && $membership->backend instanceof Reducible): ?>
|
||||||
<?= $removeForm->setAction($this->url('group/removemember', array(
|
<?= $removeForm->setAction($this->url('group/removemember', array(
|
||||||
'backend' => $membership->backend->getName(),
|
'backend' => $membership->backend->getName(),
|
||||||
'group' => $membership->group_name
|
'group' => $membership->group_name
|
||||||
|
|
Loading…
Reference in New Issue