getThem($host); } catch (Exception $e) { return array(); } } protected function getThem(Host $host) { $actions = array(); $db = $this->db(); if (! $db) { return $actions; } $hostname = $host->host_name; if (Util::hasPermission(Permission::INSPECT)) { $actions[mt('director', 'Inspect')] = Url::fromPath( 'director/inspect/object', array('type' => 'host', 'plural' => 'hosts', 'name' => $hostname) ); } $allowEdit = false; if (Util::hasPermission(Permission::HOSTS) && IcingaHost::exists($hostname, $db)) { $allowEdit = true; } if (Util::hasPermission(Permission::MONITORING_HOSTS)) { if ((new Monitoring(Auth::getInstance()))->canModifyHost($hostname)) { $allowEdit = IcingaHost::exists($hostname, $db); } } if ($allowEdit) { $actions[mt('director', 'Modify')] = Url::fromPath('director/host/edit', ['name' => $hostname]); } return $actions; } protected function db() { $resourceName = Config::module('director')->get('db', 'resource'); if (! $resourceName) { return false; } return Db::fromResourceName($resourceName); } }