/** * @return mixed */ public function getDN() { return $this->connection->getDn(); }
/** * 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; }
/** * 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; }
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(); }