IcingaServiceForm: allow to set check_command...
...for Service Apply rules, given that admin permissions have been granted. This also fixes the problem that inherited command names haven't been shown. fixes #1899
This commit is contained in:
parent
4597ce2836
commit
4413a44d65
|
@ -318,12 +318,14 @@ class IcingaServiceForm extends DirectorObjectForm
|
|||
protected function setupServiceElements()
|
||||
{
|
||||
if ($this->object) {
|
||||
$this->addHidden('object_type', $this->object->object_type);
|
||||
$objectType = $this->object->object_type;
|
||||
} elseif ($this->preferredObjectType) {
|
||||
$this->addHidden('object_type', $this->preferredObjectType);
|
||||
$objectType = $this->preferredObjectType;
|
||||
} else {
|
||||
$this->addHidden('object_type', 'template');
|
||||
$objectType = 'template';
|
||||
}
|
||||
$this->addHidden('object_type', $objectType);
|
||||
$forceCommandElements = $this->hasPermission('director/admin');
|
||||
|
||||
$this->addNameElement()
|
||||
->addHostObjectElement()
|
||||
|
@ -334,7 +336,7 @@ class IcingaServiceForm extends DirectorObjectForm
|
|||
->addApplyForElement()
|
||||
->groupMainProperties()
|
||||
->addAssignmentElements()
|
||||
->addCheckCommandElements()
|
||||
->addCheckCommandElements($forceCommandElements)
|
||||
->addCheckExecutionElements()
|
||||
->addExtraInfoElements()
|
||||
->addAgentAndZoneElements()
|
||||
|
|
|
@ -309,7 +309,7 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||
* @param $id
|
||||
* @return string
|
||||
*/
|
||||
protected function getRelatedObjectName($property, $id)
|
||||
public function getRelatedObjectName($property, $id)
|
||||
{
|
||||
return $this->getRelatedObject($property, $id)->getObjectName();
|
||||
}
|
||||
|
|
|
@ -423,6 +423,16 @@ abstract class DirectorObjectForm extends DirectorForm
|
|||
$el = $this->getElement($k);
|
||||
if ($el) {
|
||||
$this->setInheritedValue($el, $inherited->$k, $origins->$k);
|
||||
} elseif (substr($k, -3) === '_id') {
|
||||
$k = substr($k, 0, -3);
|
||||
$el = $this->getElement($k);
|
||||
if ($el) {
|
||||
$this->setInheritedValue(
|
||||
$el,
|
||||
$object->getRelatedObjectName($k, $v),
|
||||
$origins->{"${k}_id"}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue