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()
|
protected function setupServiceElements()
|
||||||
{
|
{
|
||||||
if ($this->object) {
|
if ($this->object) {
|
||||||
$this->addHidden('object_type', $this->object->object_type);
|
$objectType = $this->object->object_type;
|
||||||
} elseif ($this->preferredObjectType) {
|
} elseif ($this->preferredObjectType) {
|
||||||
$this->addHidden('object_type', $this->preferredObjectType);
|
$objectType = $this->preferredObjectType;
|
||||||
} else {
|
} else {
|
||||||
$this->addHidden('object_type', 'template');
|
$objectType = 'template';
|
||||||
}
|
}
|
||||||
|
$this->addHidden('object_type', $objectType);
|
||||||
|
$forceCommandElements = $this->hasPermission('director/admin');
|
||||||
|
|
||||||
$this->addNameElement()
|
$this->addNameElement()
|
||||||
->addHostObjectElement()
|
->addHostObjectElement()
|
||||||
|
@ -334,7 +336,7 @@ class IcingaServiceForm extends DirectorObjectForm
|
||||||
->addApplyForElement()
|
->addApplyForElement()
|
||||||
->groupMainProperties()
|
->groupMainProperties()
|
||||||
->addAssignmentElements()
|
->addAssignmentElements()
|
||||||
->addCheckCommandElements()
|
->addCheckCommandElements($forceCommandElements)
|
||||||
->addCheckExecutionElements()
|
->addCheckExecutionElements()
|
||||||
->addExtraInfoElements()
|
->addExtraInfoElements()
|
||||||
->addAgentAndZoneElements()
|
->addAgentAndZoneElements()
|
||||||
|
|
|
@ -309,7 +309,7 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
||||||
* @param $id
|
* @param $id
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getRelatedObjectName($property, $id)
|
public function getRelatedObjectName($property, $id)
|
||||||
{
|
{
|
||||||
return $this->getRelatedObject($property, $id)->getObjectName();
|
return $this->getRelatedObject($property, $id)->getObjectName();
|
||||||
}
|
}
|
||||||
|
|
|
@ -423,6 +423,16 @@ abstract class DirectorObjectForm extends DirectorForm
|
||||||
$el = $this->getElement($k);
|
$el = $this->getElement($k);
|
||||||
if ($el) {
|
if ($el) {
|
||||||
$this->setInheritedValue($el, $inherited->$k, $origins->$k);
|
$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