mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-05-30 03:20:17 +02:00
monitoring/security: Hide 'Reschedule check' link if user lacks the respective permission
This commit is contained in:
parent
af2698b075
commit
a166234e6d
@ -1,19 +1,13 @@
|
|||||||
<?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) {
|
||||||
$reschedule = $this->href(
|
$isService = false;
|
||||||
'monitoring/host/reschedule-check',
|
|
||||||
array('host' => $object->getName())
|
|
||||||
);
|
|
||||||
$checkAttempts = $object->host_current_check_attempt . '/' . $object->host_max_check_attempts;
|
$checkAttempts = $object->host_current_check_attempt . '/' . $object->host_max_check_attempts;
|
||||||
$stateType = (int) $object->host_state_type;
|
$stateType = (int) $object->host_state_type;
|
||||||
} else {
|
} else {
|
||||||
$reschedule = $this->href(
|
$isService = true;
|
||||||
'monitoring/service/reschedule-check',
|
|
||||||
array('host' => $object->getHost()->getName(), 'service' => $object->getName())
|
|
||||||
);
|
|
||||||
$checkAttempts = $object->service_attempt;
|
$checkAttempts = $object->service_attempt;
|
||||||
$stateType = (int) $object->service_state_type;
|
$stateType = (int) $object->service_state_type;
|
||||||
}
|
}
|
||||||
@ -32,29 +26,44 @@ if ($object->getType() === $object::TYPE_HOST) {
|
|||||||
<tr>
|
<tr>
|
||||||
<th><?= $this->translate('Next check') ?></th>
|
<th><?= $this->translate('Next check') ?></th>
|
||||||
<td>
|
<td>
|
||||||
|
<?php if ($this->hasPermission('monitoring/command/schedule-check')) {
|
||||||
|
if ($isService) {
|
||||||
|
$reschedule = $this->href(
|
||||||
|
'monitoring/service/reschedule-check',
|
||||||
|
array('host' => $object->getHost()->getName(), 'service' => $object->getName())
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$reschedule = $this->href(
|
||||||
|
'monitoring/host/reschedule-check',
|
||||||
|
array('host' => $object->getName())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
?>
|
||||||
<a href="<?= $reschedule ?>">
|
<a href="<?= $reschedule ?>">
|
||||||
<?= $this->icon('reschedule') ?> <?= $this->translate('Reschedule') ?>
|
<?= $this->icon('reschedule') ?>
|
||||||
|
<?= $this->translate('Reschedule') ?>
|
||||||
</a>
|
</a>
|
||||||
|
<?php } // endif ?>
|
||||||
<?= $this->timeUntil($object->next_check) ?>
|
<?= $this->timeUntil($object->next_check) ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= $this->translate('Check attempts') ?></th>
|
<th><?= $this->translate('Check attempts') ?></th>
|
||||||
<?php if ($stateType === 0): ?>
|
<?php if ($stateType === 0): ?>
|
||||||
<td><?= $checkAttempts ?> <?= $this->translate('(soft state)') ?></td>
|
<td><?= $checkAttempts ?> <?= $this->translate('(soft state)') ?></td>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<td><?= $checkAttempts ?> <?= $this->translate('(hard state)') ?></td>
|
<td><?= $checkAttempts ?> <?= $this->translate('(hard state)') ?></td>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</tr>
|
</tr>
|
||||||
<?php if ($object->check_execution_time): ?>
|
<?php if ($object->check_execution_time): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= $this->translate('Check execution time') ?></th>
|
<th><?= $this->translate('Check execution time') ?></th>
|
||||||
<td><?= $object->check_execution_time ?>s</td>
|
<td><?= $object->check_execution_time ?>s</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php if ($object->check_latency): ?>
|
<?php if ($object->check_latency): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= $this->translate('Check latency') ?></th>
|
<th><?= $this->translate('Check latency') ?></th>
|
||||||
<td><?= $object->check_latency ?>s</td>
|
<td><?= $object->check_latency ?>s</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user