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->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->setUidDisabled();
|
||||
$removeForm->setAction(
|
||||
|
@ -255,6 +255,7 @@ class GroupController extends AuthBackendController
|
|||
*/
|
||||
public function removememberAction()
|
||||
{
|
||||
$this->assertPermission('config/application/groups/member/remove');
|
||||
$this->assertHttpMethod('POST');
|
||||
$groupName = $this->params->getRequired('group');
|
||||
$backend = $this->getUserGroupBackend($this->params->getRequired('backend'), 'Icinga\Data\Reducible');
|
||||
|
|
|
@ -132,30 +132,32 @@ class UserController extends AuthBackendController
|
|||
$this->view->memberships = $memberships;
|
||||
$this->createShowTabs($backend->getName(), $userName)->activate('user/show');
|
||||
|
||||
$removeForm = new Form();
|
||||
$removeForm->setUidDisabled();
|
||||
$removeForm->addElement('hidden', 'user_name', array(
|
||||
'isArray' => true,
|
||||
'value' => $userName,
|
||||
'decorators' => array('ViewHelper')
|
||||
));
|
||||
$removeForm->addElement('hidden', 'redirect', array(
|
||||
'value' => Url::fromPath('user/show', array(
|
||||
'backend' => $backend->getName(),
|
||||
'user' => $userName
|
||||
)),
|
||||
'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('Cancel this membership')
|
||||
));
|
||||
$this->view->removeForm = $removeForm;
|
||||
if ($this->hasPermission('config/application/groups/member/remove')) {
|
||||
$removeForm = new Form();
|
||||
$removeForm->setUidDisabled();
|
||||
$removeForm->addElement('hidden', 'user_name', array(
|
||||
'isArray' => true,
|
||||
'value' => $userName,
|
||||
'decorators' => array('ViewHelper')
|
||||
));
|
||||
$removeForm->addElement('hidden', 'redirect', array(
|
||||
'value' => Url::fromPath('user/show', array(
|
||||
'backend' => $backend->getName(),
|
||||
'user' => $userName
|
||||
)),
|
||||
'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('Cancel this membership')
|
||||
));
|
||||
$this->view->removeForm = $removeForm;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -66,7 +66,7 @@ if ($this->hasPermission('config/application/users/edit') && $backend instanceof
|
|||
<?php endif ?>
|
||||
</td>
|
||||
<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(
|
||||
'backend' => $membership->backend->getName(),
|
||||
'group' => $membership->group_name
|
||||
|
|
Loading…
Reference in New Issue