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

This commit is contained in:
Eric Lippmann 2015-01-30 10:46:24 +01:00
parent bdc637ff67
commit 1681f746c1
1 changed files with 13 additions and 6 deletions

View File

@ -28,13 +28,15 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm
*/
public function createElements(array $formData = array())
{
$toggleDisabled = $this->hasPermission('monitoring/command/feature/instance') ? null : '';
$this->addElements(array(
array(
'checkbox',
ToggleObjectFeatureCommand::FEATURE_ACTIVE_CHECKS,
array(
'label' => $this->translate('Active Checks'),
'autosubmit' => true
'autosubmit' => true,
'disabled' => $toggleDisabled
)
),
array(
@ -42,7 +44,8 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm
ToggleObjectFeatureCommand::FEATURE_PASSIVE_CHECKS,
array(
'label' => $this->translate('Passive Checks'),
'autosubmit' => true
'autosubmit' => true,
'disabled' => $toggleDisabled
)
),
array(
@ -50,7 +53,8 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm
ToggleObjectFeatureCommand::FEATURE_OBSESSING,
array(
'label' => $this->translate('Obsessing'),
'autosubmit' => true
'autosubmit' => true,
'disabled' => $toggleDisabled
)
),
array(
@ -58,7 +62,8 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm
ToggleObjectFeatureCommand::FEATURE_NOTIFICATIONS,
array(
'label' => $this->translate('Notifications'),
'autosubmit' => true
'autosubmit' => true,
'disabled' => $toggleDisabled
)
),
array(
@ -66,7 +71,8 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm
ToggleObjectFeatureCommand::FEATURE_EVENT_HANDLER,
array(
'label' => $this->translate('Event Handler'),
'autosubmit' => true
'autosubmit' => true,
'disabled' => $toggleDisabled
)
),
array(
@ -74,7 +80,8 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm
ToggleObjectFeatureCommand::FEATURE_FLAP_DETECTION,
array(
'label' => $this->translate('Flap Detection'),
'autosubmit' => true
'autosubmit' => true,
'disabled' => $toggleDisabled
)
)
));