monitoring: Do not generate 'Schedule downtime' and 'Add comment' links if user lacks the respective permissions
This commit is contained in:
parent
d07e1329e8
commit
af2698b075
|
@ -1,32 +1,27 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= $this->translate('Comments') ?></th>
|
<th><?= $this->translate('Comments') ?></th>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php if ($this->hasPermission('monitoring/command/comment/add')) {
|
||||||
|
/** @type \Icinga\Module\Monitoring\Object\MonitoredObject $object */
|
||||||
/** @type \Icinga\Module\Monitoring\Object\MonitoredObject $object */
|
if ($object->getType() === $object::TYPE_HOST) {
|
||||||
|
$addCommentLink = $this->href(
|
||||||
if ($object->getType() === $object::TYPE_HOST) {
|
'monitoring/host/add-comment',
|
||||||
$addCommentLink = $this->href(
|
array('host' => $object->getName())
|
||||||
'monitoring/host/add-comment',
|
);
|
||||||
array('host' => $object->getName())
|
} else {
|
||||||
);
|
$addCommentLink = $this->href(
|
||||||
} else {
|
'monitoring/service/add-comment',
|
||||||
$addCommentLink = $this->href(
|
array('host' => $object->getHost()->getName(), 'service' => $object->getName())
|
||||||
'monitoring/service/add-comment',
|
);
|
||||||
array('host' => $object->getHost()->getName(), 'service' => $object->getName())
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if ($this->hasPermission('monitoring/command/comment/add')): ?>
|
|
||||||
<a href="<?= $addCommentLink ?>">
|
<a href="<?= $addCommentLink ?>">
|
||||||
<?= $this->icon('comment') ?>
|
<?= $this->icon('comment') ?>
|
||||||
<?= $this->translate('Add comment') ?>
|
<?= $this->translate('Add comment') ?>
|
||||||
</a>
|
</a>
|
||||||
<?php else: ?>
|
<?php } else {
|
||||||
<?= '-' ?>
|
echo '-';
|
||||||
<?php endif ?>
|
} ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
|
@ -1,32 +1,27 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= $this->translate('Downtimes') ?></th>
|
<th><?= $this->translate('Downtimes') ?></th>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php if ($this->hasPermission('monitoring/command/downtime/schedule')) {
|
||||||
|
/** @type \Icinga\Module\Monitoring\Object\MonitoredObject $object */
|
||||||
/** @type \Icinga\Module\Monitoring\Object\MonitoredObject $object */
|
if ($object->getType() === $object::TYPE_HOST) {
|
||||||
|
$scheduleDowntimeLink = $this->href(
|
||||||
if ($object->getType() === $object::TYPE_HOST) {
|
'monitoring/host/schedule-downtime',
|
||||||
$scheduleDowntimeLink = $this->href(
|
array('host' => $object->getName())
|
||||||
'monitoring/host/schedule-downtime',
|
);
|
||||||
array('host' => $object->getName())
|
} else {
|
||||||
);
|
$scheduleDowntimeLink = $this->href(
|
||||||
} else {
|
'monitoring/service/schedule-downtime',
|
||||||
$scheduleDowntimeLink = $this->href(
|
array('host' => $object->getHost()->getName(), 'service' => $object->getName())
|
||||||
'monitoring/service/schedule-downtime',
|
);
|
||||||
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->icon('plug') ?>
|
||||||
<?= $this->translate('Schedule downtime') ?>
|
<?= $this->translate('Schedule downtime') ?>
|
||||||
</a>
|
</a>
|
||||||
<?php else: ?>
|
<?php } else {
|
||||||
<?= '-' ?>
|
echo '-';
|
||||||
<?php endif ?>
|
} ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue