Show only applied groups in Icinga Host Form

This commit is contained in:
raviks789 2025-08-01 16:06:36 +02:00
parent 6749b4fb08
commit fda1e79c80
No known key found for this signature in database
2 changed files with 11 additions and 0 deletions

View File

@ -236,6 +236,12 @@ class IcingaHostForm extends DirectorObjectForm
));
$applied = $this->getAppliedGroups();
if ($this->hasHostGroupRestriction()) {
$applied = (new HostgroupRestriction($this->getDb(), $this->getAuth()))
->filterRestrictedHostgroups($applied);
}
if (! empty($applied)) {
$this->addElement('simpleNote', 'applied_groups', [
'label' => $this->translate('Applied groups'),

View File

@ -121,6 +121,11 @@ class HostgroupRestriction extends ObjectRestriction
);
}
public function filterRestrictedHostgroups(array $groups)
{
return array_intersect($groups, $this->listRestrictedHostgroups());
}
/**
* Apply the restriction to the given Hosts Query
*