示例#1
0
 /**
  * @return mixed
  */
 public function getDN()
 {
     return $this->connection->getDn();
 }
示例#2
0
 /**
  * Whether the discovery was successful
  *
  * @return bool     False when the suggestions are guessed
  */
 public function isSuccess()
 {
     $this->execDiscovery();
     return $this->connection->discoverySuccessful();
 }
 /**
  * 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;
 }
示例#4
0
 /**
  * Return whether the given object DN is related to the given base DN
  *
  * Will use the current connection's root DN if $baseDn is not given.
  *
  * @param   string  $dn         The object DN to check
  * @param   string  $baseDn     The base DN to compare the object DN with
  *
  * @return  bool
  */
 protected function isRelatedDn($dn, $baseDn = null)
 {
     $normalizedDn = strtolower(join(',', array_map('trim', explode(',', $dn))));
     $normalizedBaseDn = strtolower(join(',', array_map('trim', explode(',', $baseDn ?: $this->ds->getDn()))));
     return strpos($normalizedDn, $normalizedBaseDn) !== false;
 }
示例#5
0
 private function emptySelect()
 {
     $config = new ConfigObject(array('hostname' => 'localhost', 'root_dn' => 'dc=example,dc=com', 'bind_dn' => 'cn=user,ou=users,dc=example,dc=com', 'bind_pw' => '***'));
     $connection = new LdapConnection($config);
     return $connection->select();
 }