Only show edit role link if user has the appropriate permission
This commit is contained in:
parent
57b64f85bf
commit
564fb8c320
|
@ -170,6 +170,7 @@ class UserController extends AuthBackendController
|
||||||
$admissionLoader = new AdmissionLoader();
|
$admissionLoader = new AdmissionLoader();
|
||||||
$admissionLoader->applyRoles($userObj);
|
$admissionLoader->applyRoles($userObj);
|
||||||
$this->view->userObj = $userObj;
|
$this->view->userObj = $userObj;
|
||||||
|
$this->view->allowedToEditRoles = $this->hasPermission('config/authentication/roles/edit');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -43,22 +43,27 @@ use Icinga\Data\Selectable;
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= $this->translate('Role Memberships'); ?></th>
|
<th><?= $this->translate('Role Memberships'); ?></th>
|
||||||
<td>
|
<td>
|
||||||
<?php $roleObj = $userObj->getRoles(); ?>
|
<?php $roleObj = $userObj->getRoles(); ?>
|
||||||
<?php if (! empty($roleObj)): ?>
|
<?php if (! empty($roleObj)): ?>
|
||||||
<ul class="role-memberships">
|
<ul class="role-memberships">
|
||||||
<?php foreach($roleObj as $role): ?>
|
<?php foreach($roleObj as $role): ?>
|
||||||
<li><?= $this->qlink(
|
<li>
|
||||||
$role->getName(),
|
<?php if ($this->allowedToEditRoles): ?>
|
||||||
'role/edit',
|
<?= $this->qlink(
|
||||||
['role' => $role->getName()],
|
$role->getName(),
|
||||||
['title' => sprintf($this->translate('Edit role %s'), $role->getName())]
|
'role/edit',
|
||||||
) ?>
|
['role' => $role->getName()],
|
||||||
</li>
|
['title' => sprintf($this->translate('Edit role %s'), $role->getName())]
|
||||||
<?php endforeach ?>
|
) ?>
|
||||||
</ul>
|
<?php else: ?>
|
||||||
<?php else: ?>
|
<?= $role->getName() ?>
|
||||||
<p><?= $this->translate('No memberships found'); ?></p>
|
<?php endif ?>
|
||||||
<?php endif ?>
|
</li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
<?php else: ?>
|
||||||
|
<p><?= $this->translate('No memberships found'); ?></p>
|
||||||
|
<?php endif ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in New Issue