monitoring/security: Hide 'Schedule downtime' link if user lacks the respective permission
This commit is contained in:
parent
67be1b329b
commit
f47dae1092
|
@ -3,7 +3,7 @@
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
|
/** @type \Icinga\Module\Monitoring\Object\MonitoredObject $object */
|
||||||
|
|
||||||
if ($object->getType() === $object::TYPE_HOST) {
|
if ($object->getType() === $object::TYPE_HOST) {
|
||||||
$scheduleDowntimeLink = $this->href(
|
$scheduleDowntimeLink = $this->href(
|
||||||
|
@ -16,10 +16,17 @@
|
||||||
array('host' => $object->getHost()->getName(), 'service' => $object->getName())
|
array('host' => $object->getHost()->getName(), 'service' => $object->getName())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<?php if ($this->hasPermission('monitoring/command/downtime/schedule')): ?>
|
||||||
<a href="<?= $scheduleDowntimeLink ?>">
|
<a href="<?= $scheduleDowntimeLink ?>">
|
||||||
<?= $this->icon('plug') ?> <?= $this->translate('Schedule downtime') ?>
|
<?= $this->icon('plug') ?>
|
||||||
|
<?= $this->translate('Schedule downtime') ?>
|
||||||
</a>
|
</a>
|
||||||
|
<?php else: ?>
|
||||||
|
<?= '-' ?>
|
||||||
|
<?php endif ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
@ -52,9 +59,9 @@ foreach ($object->downtimes as $downtime) {
|
||||||
<tr>
|
<tr>
|
||||||
<td style="vertical-align: top;" data-base-target="_self">
|
<td style="vertical-align: top;" data-base-target="_self">
|
||||||
<?php if (isset($delDowntimeForm)) { // Form is unset if the current user lacks the respective permission
|
<?php if (isset($delDowntimeForm)) { // Form is unset if the current user lacks the respective permission
|
||||||
$form = clone $delDowntimeForm;
|
$delDowntimeForm = clone $delDowntimeForm;
|
||||||
$form->populate(array('downtime_id' => $downtime->id));
|
$delDowntimeForm->populate(array('downtime_id' => $downtime->id));
|
||||||
echo $form;
|
echo $delDowntimeForm;
|
||||||
} ?>
|
} ?>
|
||||||
<?= $state ?>
|
<?= $state ?>
|
||||||
</td>
|
</td>
|
||||||
|
@ -66,4 +73,4 @@ foreach ($object->downtimes as $downtime) {
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php } // endforeach ?>
|
<?php } // endforeach ?>
|
||||||
|
|
Loading…
Reference in New Issue