function _cas_ldap_attributes in CAS Attributes 7
Look up the user attributes for the specified user.
1 call to _cas_ldap_attributes()
- cas_ldap_attributes in ./
cas_ldap.module - Returns an array containing LDAP attributes for the specified user.
File
- ./
cas_ldap.module, line 70 - Allows user account and profile attributes to be automatically populated using tokens. Provides basic tokens for attributes returned by an LDAP server.
Code
function _cas_ldap_attributes($name) {
$cas_attr_ldap_server = variable_get('cas_attributes_ldap_server', NULL);
if (empty($cas_attr_ldap_server)) {
// No CAS server configured.
return array();
}
$ldap_server = ldap_servers_get_servers($cas_attr_ldap_server, 'enabled', TRUE);
if (empty($ldap_server)) {
// We cannot load the server.
return array();
}
// Connect to the server and perform the lookup.
$ldap_server
->connect();
$ldap_server
->bind();
$result = $ldap_server
->user_lookup($name);
if ($result) {
return $result['attr'];
}
else {
return array();
}
}