function ldap_servers_update_8304 in Lightweight Directory Access Protocol (LDAP) 8.3
Same name and namespace in other branches
- 8.4 ldap_servers/ldap_servers.install \ldap_servers_update_8304()
Force server attributes to be lowercase.
File
- ldap_servers/
ldap_servers.install, line 95 - Install, update and uninstall functions for the LDAP API module.
Code
function ldap_servers_update_8304() {
$factory = \Drupal::service('ldap.servers');
/** @var \Drupal\ldap_servers\ServerFactory $factory */
$servers = $factory
->getAllServers();
foreach ($servers as $server) {
$fields = [
'user_attr',
'account_name_attr',
'mail_attr',
'mail_template',
'picture_attr',
'unique_persistent_attr',
'user_dn_expression',
'grp_memb_attr',
'grp_object_cat',
'grp_memb_attr_match_user_attr',
'grp_user_memb_attr',
'grp_derive_from_dn_attr',
];
foreach ($fields as $field) {
$server
->set($field, mb_strtolower($server
->get($field)));
}
$server
->save();
}
return t('All server configuration attributes are forced to lowercase. Note that exporting this state can contain configuration overrides. Please review.');
}