mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-27 15:54:03 +02:00
parent
d35c6858a1
commit
fcbc2db71b
@ -253,16 +253,7 @@ class IcingaHostForm extends DirectorObjectForm
|
|||||||
protected function getInheritedGroups()
|
protected function getInheritedGroups()
|
||||||
{
|
{
|
||||||
if ($this->hasObject()) {
|
if ($this->hasObject()) {
|
||||||
$parents = $this->object->imports()->getObjects();
|
return $this->object->getInheritedGroups();
|
||||||
/** @var IcingaHost $parent */
|
|
||||||
foreach (array_reverse($parents) as $parent) {
|
|
||||||
$inherited = $parent->getGroups();
|
|
||||||
if (! empty($inherited)) {
|
|
||||||
return $inherited;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return [];
|
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -773,7 +773,7 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return IcingaObjectGroups[]
|
* @return IcingaObjectGroups
|
||||||
*/
|
*/
|
||||||
public function groups()
|
public function groups()
|
||||||
{
|
{
|
||||||
@ -1010,6 +1010,20 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||||||
return $this->groups()->listGroupNames();
|
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)
|
public function setGroups($groups)
|
||||||
{
|
{
|
||||||
$this->groups()->set($groups);
|
$this->groups()->set($groups);
|
||||||
@ -2558,7 +2572,12 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||||||
|
|
||||||
if ($this->supportsGroups()) {
|
if ($this->supportsGroups()) {
|
||||||
// TODO: resolve
|
// 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) {
|
foreach ($this->loadAllMultiRelations() as $key => $rel) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user