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