From a166234e6d3242021c34a56b6f7ac67dcad6d2ba Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 23 Jan 2015 10:40:48 +0100 Subject: [PATCH] monitoring/security: Hide 'Reschedule check' link if user lacks the respective permission --- .../show/components/checkstatistics.phtml | 49 +++++++++++-------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/modules/monitoring/application/views/scripts/show/components/checkstatistics.phtml b/modules/monitoring/application/views/scripts/show/components/checkstatistics.phtml index e8c295298..5b54ae4ab 100644 --- a/modules/monitoring/application/views/scripts/show/components/checkstatistics.phtml +++ b/modules/monitoring/application/views/scripts/show/components/checkstatistics.phtml @@ -1,19 +1,13 @@ getType() === $object::TYPE_HOST) { - $reschedule = $this->href( - 'monitoring/host/reschedule-check', - array('host' => $object->getName()) - ); + $isService = false; $checkAttempts = $object->host_current_check_attempt . '/' . $object->host_max_check_attempts; $stateType = (int) $object->host_state_type; } else { - $reschedule = $this->href( - 'monitoring/service/reschedule-check', - array('host' => $object->getHost()->getName(), 'service' => $object->getName()) - ); + $isService = true; $checkAttempts = $object->service_attempt; $stateType = (int) $object->service_state_type; } @@ -32,29 +26,44 @@ if ($object->getType() === $object::TYPE_HOST) { translate('Next check') ?> + 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()) + ); + } + ?> - icon('reschedule') ?> translate('Reschedule') ?> + icon('reschedule') ?> + translate('Reschedule') ?> + timeUntil($object->next_check) ?> translate('Check attempts') ?> - translate('(soft state)') ?> + translate('(soft state)') ?> - translate('(hard state)') ?> + translate('(hard state)') ?> check_execution_time): ?> - - translate('Check execution time') ?> - check_execution_time ?>s - + + translate('Check execution time') ?> + check_execution_time ?>s + check_latency): ?> - - translate('Check latency') ?> - check_latency ?>s - + + translate('Check latency') ?> + check_latency ?>s +