public function ServerFactory::alterLdapAttributes in Lightweight Directory Access Protocol (LDAP) 8.3
Alter the LDAP attributes.
Parameters
array $attributes: Attributes.
array $params: Parameters.
Return value
array Altered attributes.
File
- ldap_servers/
src/ ServerFactory.php, line 219
Class
- ServerFactory
- Helper class to working with the Server classes.
Namespace
Drupal\ldap_serversCode
public function alterLdapAttributes(array &$attributes, array $params) {
// Force this data type.
$attributes['dn'] = ConversionHelper::setAttributeMap(@$attributes['dn'], 'ldap_dn');
// Puid attributes are server specific.
if (isset($params['sid']) && $params['sid']) {
if (is_scalar($params['sid'])) {
$ldap_server = $this
->getServerById($params['sid']);
if ($ldap_server) {
// The attributes mail, unique_persistent_attr, user_attr,
// mail_template, and user_dn_expression are needed for all
// functionality.
if (!isset($attributes[$ldap_server
->get('mail_attr')])) {
$attributes[$ldap_server
->get('mail_attr')] = ConversionHelper::setAttributeMap();
}
if ($ldap_server
->get('picture_attr') && !isset($attributes[$ldap_server
->get('picture_attr')])) {
$attributes[$ldap_server
->get('picture_attr')] = ConversionHelper::setAttributeMap();
}
if ($ldap_server
->get('unique_persistent_attr') && !isset($attributes[$ldap_server
->get('unique_persistent_attr')])) {
$attributes[$ldap_server
->get('unique_persistent_attr')] = ConversionHelper::setAttributeMap();
}
if ($ldap_server
->get('user_dn_expression')) {
ConversionHelper::extractTokenAttributes($attributes, $ldap_server
->get('user_dn_expression'));
}
if ($ldap_server
->get('mail_template')) {
ConversionHelper::extractTokenAttributes($attributes, $ldap_server
->get('mail_template'));
}
if (!isset($attributes[$ldap_server
->get('user_attr')])) {
$attributes[$ldap_server
->get('user_attr')] = ConversionHelper::setAttributeMap();
}
}
}
}
return $attributes;
}