monitoring/security: Hide 'Remove Problem Acknowledgement' action if user lacks the respective permission

This commit is contained in:
Eric Lippmann 2015-01-22 17:25:30 +01:00
parent a09ba15859
commit f46a587266
2 changed files with 14 additions and 6 deletions

View File

@ -22,7 +22,13 @@ if ($object->getType() === $object::TYPE_HOST) {
if ($object->acknowledged): ?>
<tr>
<th><?= $this->translate('Acknowledged') ?></th>
<td><?= $removeAckForm ?></td>
<td>
<?php if (isset($removeAckForm)) { // Form is unset if the current user lacks the respective permission
echo $removeAckForm;
} else {
echo '&#45;';
} ?>
</td>
</tr>
<?php else: ?>
<tr>

View File

@ -67,11 +67,13 @@ abstract class MonitoredObjectController extends Controller
}
if ( ! in_array((int) $this->object->state, array(0, 99))) {
if ((bool) $this->object->acknowledged) {
$removeAckForm = new RemoveAcknowledgementCommandForm();
$removeAckForm
->setObjects($this->object)
->handleRequest();
$this->view->removeAckForm = $removeAckForm;
if ($auth->hasPermission('monitoring/command/remove-acknowledgement')) {
$removeAckForm = new RemoveAcknowledgementCommandForm();
$removeAckForm
->setObjects($this->object)
->handleRequest();
$this->view->removeAckForm = $removeAckForm;
}
} else {
$ackForm = new AcknowledgeProblemCommandForm();
$ackForm