public function LdapServerTest::createLdapEntry in Lightweight Directory Access Protocol (LDAP) 7.2
Same name and namespace in other branches
- 8.2 ldap_test/LdapServerTest.class.php \LdapServerTest::createLdapEntry()
Create ldap entry.
Parameters
array $ldap_entry: should follow the structure of ldap_add functions entry array: http://us.php.net/manual/en/function.ldap-add.php $attributes["attribute1"] = "value"; $attributes["attribute2"][0] = "value1"; $attributes["attribute2"][1] = "value2";.
Return value
boolean result
Overrides LdapServer::createLdapEntry
File
- ldap_test/
LdapServerTest.class.php, line 403 - Simpletest ldapServer class for testing without an actual ldap server.
Class
Code
public function createLdapEntry($ldap_entry, $dn = NULL) {
$result = FALSE;
$test_data = variable_get('ldap_test_server__' . $this->sid, []);
if (isset($ldap_entry['dn'])) {
$dn = $ldap_entry['dn'];
unset($ldap_entry['dn']);
}
if ($dn && !isset($test_data['entries'][$dn])) {
$test_data['entries'][$dn] = $ldap_entry;
$test_data['ldap'][$dn] = $ldap_entry;
variable_set('ldap_test_server__' . $this->sid, $test_data);
$this
->refreshFakeData();
$result = TRUE;
}
return $result;
}