getThem($host); } catch (Exception $e) { return []; } } protected function getThem(Host $host): array { $actions = []; $db = $this->db(); if (! $db) { return $actions; } $hostname = $host->name; if (Util::hasPermission(Permission::INSPECT)) { $actions[] = new Link( mt('director', 'Inspect'), Url::fromPath( 'director/inspect/object', ['type' => 'host', 'plural' => 'hosts', 'name' => $hostname] ) ); } $allowEdit = false; if (Util::hasPermission(Permission::HOSTS) && IcingaHost::exists($hostname, $db)) { $allowEdit = true; } if (Util::hasPermission(Permission::ICINGADB_HOSTS)) { if ((new IcingadbBackend())->canModifyHost($hostname)) { $allowEdit = IcingaHost::exists($hostname, $db); } } if ($allowEdit) { $label = mt('director', 'Modify'); $actions[] = new Link( $label, 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); } }