monitoring/security: Disable toggling instance features if user lacks the permission monitoring/command/feature/instance

This commit is contained in:
Eric Lippmann 2015-01-30 10:01:03 +01:00
parent 26613a0106
commit 3716be4a48
1 changed files with 21 additions and 10 deletions

View File

@ -73,13 +73,15 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
} else { } else {
$notificationDescription = null; $notificationDescription = null;
} }
$toggleDisabled = ! $this->hasPermission('monitoring/command/feature/instance');
$this->addElements(array( $this->addElements(array(
array( array(
'checkbox', 'checkbox',
ToggleInstanceFeatureCommand::FEATURE_ACTIVE_HOST_CHECKS, ToggleInstanceFeatureCommand::FEATURE_ACTIVE_HOST_CHECKS,
array( array(
'label' => $this->translate('Active Host Checks Being Executed'), 'label' => $this->translate('Active Host Checks Being Executed'),
'autosubmit' => true 'autosubmit' => true,
'disabled' => $toggleDisabled
) )
), ),
array( array(
@ -87,7 +89,8 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
ToggleInstanceFeatureCommand::FEATURE_ACTIVE_SERVICE_CHECKS, ToggleInstanceFeatureCommand::FEATURE_ACTIVE_SERVICE_CHECKS,
array( array(
'label' => $this->translate('Active Service Checks Being Executed'), 'label' => $this->translate('Active Service Checks Being Executed'),
'autosubmit' => true 'autosubmit' => true,
'disabled' => $toggleDisabled
) )
), ),
array( array(
@ -95,7 +98,8 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
ToggleInstanceFeatureCommand::FEATURE_EVENT_HANDLERS, ToggleInstanceFeatureCommand::FEATURE_EVENT_HANDLERS,
array( array(
'label' => $this->translate('Event Handlers Enabled'), 'label' => $this->translate('Event Handlers Enabled'),
'autosubmit' => true 'autosubmit' => true,
'disabled' => $toggleDisabled
) )
), ),
array( array(
@ -103,7 +107,8 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
ToggleInstanceFeatureCommand::FEATURE_FLAP_DETECTION, ToggleInstanceFeatureCommand::FEATURE_FLAP_DETECTION,
array( array(
'label' => $this->translate('Flap Detection Enabled'), 'label' => $this->translate('Flap Detection Enabled'),
'autosubmit' => true 'autosubmit' => true,
'disabled' => $toggleDisabled
) )
), ),
array( array(
@ -122,7 +127,8 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
), ),
'Label', 'Label',
array('HtmlTag', array('tag' => 'div')) array('HtmlTag', array('tag' => 'div'))
) ),
'disabled' => $toggleDisabled
) )
), ),
array( array(
@ -130,7 +136,8 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
ToggleInstanceFeatureCommand::FEATURE_HOST_OBSESSING, ToggleInstanceFeatureCommand::FEATURE_HOST_OBSESSING,
array( array(
'label' => $this->translate('Obsessing Over Hosts'), 'label' => $this->translate('Obsessing Over Hosts'),
'autosubmit' => true 'autosubmit' => true,
'disabled' => $toggleDisabled
) )
), ),
array( array(
@ -138,7 +145,8 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
ToggleInstanceFeatureCommand::FEATURE_SERVICE_OBSESSING, ToggleInstanceFeatureCommand::FEATURE_SERVICE_OBSESSING,
array( array(
'label' => $this->translate('Obsessing Over Services'), 'label' => $this->translate('Obsessing Over Services'),
'autosubmit' => true 'autosubmit' => true,
'disabled' => $toggleDisabled
) )
), ),
array( array(
@ -146,7 +154,8 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
ToggleInstanceFeatureCommand::FEATURE_PASSIVE_HOST_CHECKS, ToggleInstanceFeatureCommand::FEATURE_PASSIVE_HOST_CHECKS,
array( array(
'label' => $this->translate('Passive Host Checks Being Accepted'), 'label' => $this->translate('Passive Host Checks Being Accepted'),
'autosubmit' => true 'autosubmit' => true,
'disabled' => $toggleDisabled
) )
), ),
array( array(
@ -154,7 +163,8 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
ToggleInstanceFeatureCommand::FEATURE_PASSIVE_SERVICE_CHECKS, ToggleInstanceFeatureCommand::FEATURE_PASSIVE_SERVICE_CHECKS,
array( array(
'label' => $this->translate('Passive Service Checks Being Accepted'), 'label' => $this->translate('Passive Service Checks Being Accepted'),
'autosubmit' => true 'autosubmit' => true,
'disabled' => $toggleDisabled
) )
), ),
array( array(
@ -162,7 +172,8 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
ToggleInstanceFeatureCommand::FEATURE_PERFORMANCE_DATA, ToggleInstanceFeatureCommand::FEATURE_PERFORMANCE_DATA,
array( array(
'label' => $this->translate('Performance Data Being Processed'), 'label' => $this->translate('Performance Data Being Processed'),
'autosubmit' => true 'autosubmit' => true,
'disabled' => $toggleDisabled
) )
) )
)); ));