diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:17:47 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:17:47 +0000 |
commit | 5419d4428c86c488a43124f85e5407d7cbae6541 (patch) | |
tree | 772c4221a20fd7d1b3e7e67c6e21755a50e80fd7 /application/controllers/ServiceController.php | |
parent | Adding upstream version 1.10.2. (diff) | |
download | icingaweb2-module-director-upstream.tar.xz icingaweb2-module-director-upstream.zip |
Adding upstream version 1.11.1.upstream/1.11.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | application/controllers/ServiceController.php | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index 3cd54d6..b62f317 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -4,11 +4,10 @@ namespace Icinga\Module\Director\Controllers; use Exception; use Icinga\Exception\NotFoundError; -use Icinga\Module\Director\Data\Db\DbObjectStore; +use Icinga\Module\Director\Auth\Permission; use Icinga\Module\Director\Data\Db\DbObjectTypeRegistry; use Icinga\Module\Director\Db\Branch\UuidLookup; use Icinga\Module\Director\Forms\IcingaServiceForm; -use Icinga\Module\Director\Monitoring; use Icinga\Module\Director\Objects\IcingaObject; use Icinga\Module\Director\Web\Controller\ObjectController; use Icinga\Module\Director\Objects\IcingaService; @@ -30,13 +29,14 @@ class ServiceController extends ObjectController protected function checkDirectorPermissions() { - if ($this->hasPermission('director/monitoring/services')) { - $monitoring = new Monitoring(); - if ($monitoring->authCanEditService($this->Auth(), $this->getParam('host'), $this->getParam('name'))) { - return; - } + if ($this->host + && $this->object + && $this->backend()->canModifyService($this->host->getObjectName(), $this->object->getObjectName()) + ) { + return; } - $this->assertPermission('director/hosts'); + + $this->assertPermission(Permission::HOSTS); } public function init() @@ -62,7 +62,7 @@ class ServiceController extends ObjectController protected function getOptionalRelatedObjectFromParams($type, $parameter) { - if ($id = $this->params->get("${parameter}_id")) { + if ($id = $this->params->get("{$parameter}_id")) { $key = (int) $id; } else { $key = $this->params->get($parameter); @@ -80,7 +80,7 @@ class ServiceController extends ObjectController { $key = $object->getUnresolvedRelated($relation); if ($key === null) { - if ($key = $object->get("${relation}_id")) { + if ($key = $object->get("{$relation}_id")) { $key = (int) $key; } else { $key = $object->get($relation); |