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