parent
d35c6858a1
commit
fcbc2db71b
|
@ -253,16 +253,7 @@ class IcingaHostForm extends DirectorObjectForm
|
|||
protected function getInheritedGroups()
|
||||
{
|
||||
if ($this->hasObject()) {
|
||||
$parents = $this->object->imports()->getObjects();
|
||||
/** @var IcingaHost $parent */
|
||||
foreach (array_reverse($parents) as $parent) {
|
||||
$inherited = $parent->getGroups();
|
||||
if (! empty($inherited)) {
|
||||
return $inherited;
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
return $this->object->getInheritedGroups();
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
|
|
|
@ -773,7 +773,7 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||
}
|
||||
|
||||
/**
|
||||
* @return IcingaObjectGroups[]
|
||||
* @return IcingaObjectGroups
|
||||
*/
|
||||
public function groups()
|
||||
{
|
||||
|
@ -1010,6 +1010,20 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||
return $this->groups()->listGroupNames();
|
||||
}
|
||||
|
||||
public function getInheritedGroups()
|
||||
{
|
||||
$parents = $this->imports()->getObjects();
|
||||
/** @var IcingaObject $parent */
|
||||
foreach (array_reverse($parents) as $parent) {
|
||||
$inherited = $parent->getGroups();
|
||||
if (! empty($inherited)) {
|
||||
return $inherited;
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
public function setGroups($groups)
|
||||
{
|
||||
$this->groups()->set($groups);
|
||||
|
@ -2558,7 +2572,12 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||
|
||||
if ($this->supportsGroups()) {
|
||||
// TODO: resolve
|
||||
$props['groups'] = $this->groups()->listGroupNames();
|
||||
$groups = $this->groups()->listGroupNames();
|
||||
if ($resolved && empty($groups)) {
|
||||
$groups = $this->getInheritedGroups();
|
||||
}
|
||||
|
||||
$props['groups'] = $groups;
|
||||
}
|
||||
|
||||
foreach ($this->loadAllMultiRelations() as $key => $rel) {
|
||||
|
|
Loading…
Reference in New Issue