summaryrefslogtreecommitdiffstats
path: root/application/controllers/ServiceController.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/controllers/ServiceController.php')
-rw-r--r--application/controllers/ServiceController.php20
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);