public function LdapTestFunctions::setFakeServerUserAttribute in Lightweight Directory Access Protocol (LDAP) 7.2
Same name and namespace in other branches
- 8.2 ldap_test/LdapTestFunctions.class.php \LdapTestFunctions::setFakeServerUserAttribute()
File
- ldap_test/
LdapTestFunctions.class.php, line 63
Class
Code
public function setFakeServerUserAttribute($sid, $dn, $attr_name, $attr_value, $i = 0) {
$attr_name = drupal_strtolower($attr_name);
$test_data = variable_get('ldap_test_server__' . $sid, []);
$test_data['entries'][$dn][$attr_name][$i] = $attr_value;
$count_set = (int) isset($test_data['entries'][$dn][$attr_name]['count']);
// don't count the 'count'.
$test_data['entries'][$dn][$attr_name]['count'] = count($test_data['entries'][$dn][$attr_name]) - $count_set;
$test_data['ldap'][$dn][$attr_name][$i] = $attr_value;
$count_set = (int) isset($test_data['ldap'][$dn][$attr_name]['count']);
// don't count the 'count'.
$test_data['ldap'][$dn][$attr_name]['count'] = count($test_data['ldap'][$dn][$attr_name]) - $count_set;
variable_set('ldap_test_server__' . $sid, $test_data);
// Clear server cache;.
$ldap_server = ldap_servers_get_servers($sid, NULL, TRUE, TRUE);
}