コード例 #1
0
ファイル: Discovery.php プロジェクト: hsanjuan/icingaweb2
 /**
  * Suggests a resource configuration of hostname, port and root_dn
  * based on the discovery
  *
  * @return array    The suggested configuration as an array
  */
 public function suggestResourceSettings()
 {
     if (!$this->discovered) {
         $this->execDiscovery();
     }
     return array('hostname' => $this->connection->getHostname(), 'port' => $this->connection->getPort(), 'root_dn' => $this->connection->getCapabilities()->getDefaultNamingContext());
 }
コード例 #2
0
 /**
  * Return the names of all configured LDAP user backends
  *
  * @param   LdapConnection  $resource
  *
  * @return  array
  */
 protected function getLdapUserBackendNames(LdapConnection $resource)
 {
     $names = array();
     foreach (UserBackend::getBackendConfigs() as $name => $config) {
         if (in_array(strtolower($config->backend), array('ldap', 'msldap'))) {
             $backendResource = ResourceFactory::create($config->resource);
             if ($backendResource->getHostname() === $resource->getHostname() && $backendResource->getPort() === $resource->getPort()) {
                 $names[] = $name;
             }
         }
     }
     return $names;
 }