function LdapServer::dnExists in Lightweight Directory Access Protocol (LDAP) 8.2
Same name and namespace in other branches
- 7.2 ldap_servers/LdapServer.class.php \LdapServer::dnExists()
does dn exist for this server? [ ] Finished [ ] Test Coverage. Test ID: [ ] Case insensitive
Parameters
string $dn:
enum $return = 'boolean' or 'ldap_entry':
array $attributes in same form as ldap_read $attributes parameter:
return FALSE or ldap entry array:
4 calls to LdapServer::dnExists()
- LdapServer::groupAddGroup in ldap_servers/
LdapServer.class.php - NOT TESTED add a group entry
- LdapServer::groupAllMembers in ldap_servers/
LdapServer.class.php - @todo: NOT IMPLEMENTED: nested groups
- LdapServer::userUsernameFromDn in ldap_servers/
LdapServer.class.php - LdapServer::userUserToExistingLdapEntry in ldap_servers/
LdapServer.class.php
1 method overrides LdapServer::dnExists()
- LdapServerTest::dnExists in ldap_test/
LdapServerTest.class.php - does dn exist for this server?
File
- ldap_servers/
LdapServer.class.php, line 364 - Defines server classes and related functions.
Class
- LdapServer
- LDAP Server Class
Code
function dnExists($dn, $return = 'boolean', $attributes = NULL) {
$params = array(
'base_dn' => $dn,
'attributes' => $attributes,
'attrsonly' => FALSE,
'filter' => '(objectclass=*)',
'sizelimit' => 0,
'timelimit' => 0,
'deref' => NULL,
);
if ($return == 'boolean' || !is_array($attributes)) {
$params['attributes'] = array(
'objectclass',
);
}
else {
$params['attributes'] = $attributes;
}
$result = $this
->ldapQuery(LDAP_SCOPE_BASE, $params);
if ($result !== FALSE) {
$entries = @ldap_get_entries($this->connection, $result);
if ($entries !== FALSE && $entries['count'] > 0) {
return $return == 'boolean' ? TRUE : $entries[0];
}
}
return FALSE;
}