From 5419d4428c86c488a43124f85e5407d7cbae6541 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 15:17:47 +0200 Subject: Adding upstream version 1.11.1. Signed-off-by: Daniel Baumann --- application/forms/IcingaHostForm.php | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'application/forms/IcingaHostForm.php') diff --git a/application/forms/IcingaHostForm.php b/application/forms/IcingaHostForm.php index ec71471..ed57251 100644 --- a/application/forms/IcingaHostForm.php +++ b/application/forms/IcingaHostForm.php @@ -3,6 +3,8 @@ namespace Icinga\Module\Director\Forms; use Icinga\Exception\AuthenticationException; +use Icinga\Module\Director\Auth\Permission; +use Icinga\Module\Director\Auth\Restriction; use Icinga\Module\Director\Repository\IcingaTemplateRepository; use Icinga\Module\Director\Restriction\HostgroupRestriction; use Icinga\Module\Director\Web\Form\DirectorObjectForm; @@ -162,7 +164,7 @@ class IcingaHostForm extends DirectorObjectForm if ($this->hasBeenSent()) { $this->addError($this->translate('No Host template has been chosen')); } else { - if ($this->hasPermission('director/admin')) { + if ($this->hasPermission(Permission::ADMIN)) { $html = sprintf( $this->translate('Please define a %s first'), Link::create( @@ -208,7 +210,7 @@ class IcingaHostForm extends DirectorObjectForm protected function addGroupsElement() { if ($this->hasHostGroupRestriction() - && ! $this->getAuth()->hasPermission('director/groups-for-restricted-hosts') + && ! $this->getAuth()->hasPermission(Permission::GROUPS_FOR_RESTRICTED_HOSTS) ) { return $this; } @@ -262,15 +264,6 @@ class IcingaHostForm extends DirectorObjectForm return $this; } - protected function strikeGroupLinks(BaseHtmlElement $links) - { - /** @var BaseHtmlElement $link */ - foreach ($links->getContent() as $link) { - $link->getAttributes()->add('style', 'text-decoration: strike'); - } - $links->add('aha'); - } - protected function getInheritedGroups() { if ($this->hasObject()) { @@ -295,9 +288,7 @@ class IcingaHostForm extends DirectorObjectForm ); } - return Html::tag('span', [ - 'style' => 'line-height: 2.5em; padding-left: 0.5em' - ], $links); + return Html::tag('span', ['class' => 'host-group-links'], $links); } protected function getAppliedGroups() @@ -311,7 +302,7 @@ class IcingaHostForm extends DirectorObjectForm protected function hasHostGroupRestriction() { - return $this->getAuth()->getRestrictions('director/filter/hostgroups'); + return $this->getAuth()->getRestrictions(Restriction::FILTER_HOSTGROUPS); } /** -- cgit v1.2.3