diff --git a/app/Controller/ServicesController.php b/app/Controller/ServicesController.php index acf2a52c1b..ba3d74a5e8 100755 --- a/app/Controller/ServicesController.php +++ b/app/Controller/ServicesController.php @@ -704,12 +704,18 @@ public function add() { $this->loadModel('Customvariable'); $userContainerId = $this->Auth->user('container_id'); + $myContainerId = $this->Tree->resolveChildrenOfContainerIds($this->MY_RIGHTS); + $myRights = $myContainerId; + if(!$this->hasRootPrivileges && ($rootKey = array_search(ROOT_CONTAINER, $myRights)) !== false){ + unset($myRights[$rootKey]); + } $hosts = $this->Host->find('list', [ 'conditions' => [ - 'Host.host_type' => GENERIC_HOST + 'Host.host_type' => GENERIC_HOST, + 'Host.container_id' => $myRights ] ]); - $myContainerId = $this->Tree->resolveChildrenOfContainerIds($this->MY_RIGHTS); + $servicetemplates = $this->Servicetemplate->servicetemplatesByContainerId($myContainerId, 'list'); $timeperiods = $this->Timeperiod->find('list'); //container_id = 1 => ROOT