public function LdapServerTest::dnExists in Lightweight Directory Access Protocol (LDAP) 7.2
Same name and namespace in other branches
- 8.2 ldap_test/LdapServerTest.class.php \LdapServerTest::dnExists()
Does dn exist for this server?
Parameters
string $dn:
enum $return: = 'boolean' or 'ldap_entry'.
return FALSE or ldap entry array:
Overrides LdapServer::dnExists
File
- ldap_test/
LdapServerTest.class.php, line 346 - Simpletest ldapServer class for testing without an actual ldap server.
Class
Code
public function dnExists($find_dn, $return = 'boolean', $attributes = [
'objectclass',
]) {
$this
->refreshFakeData();
$test_data = variable_get('ldap_test_server__' . $this->sid, []);
foreach ($this->entries as $entry_dn => $entry) {
$match = strcasecmp($entry_dn, $find_dn) == 0;
if ($match) {
return $return == 'boolean' ? TRUE : $entry;
}
}
// Not match found in loop.
return FALSE;
}