function LdapUserConf::setSynchMapping in Lightweight Directory Access Protocol (LDAP) 8.2
Same name and namespace in other branches
- 7.2 ldap_user/LdapUserConf.class.php \LdapUserConf::setSynchMapping()
derive mapping array from ldap user configuration and other configurations. if this becomes a resource hungry function should be moved to ldap_user functions and stored with static variable. should be cached also.
this should be cached and modules implementing ldap_user_synch_mapping_alter should know when to invalidate cache.
1 call to LdapUserConf::setSynchMapping()
- LdapUserConf::__construct in ldap_user/
LdapUserConf.class.php
File
- ldap_user/
LdapUserConf.class.php, line 413
Class
Code
function setSynchMapping($reset = TRUE) {
// @todo change default to false after development
$synch_mapping_cache = cache_get('ldap_user_synch_mapping');
if (!$reset && $synch_mapping_cache) {
$this->synchMapping = $synch_mapping_cache->data;
}
else {
$available_user_attrs = array();
foreach (array(
LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER,
LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY,
) as $direction) {
$sid = $this->provisionSidFromDirection[$direction];
$available_user_attrs[$direction] = array();
$ldap_server = $sid ? ldap_servers_get_servers($sid, NULL, TRUE) : FALSE;
$params = array(
'ldap_server' => $ldap_server,
'ldap_user_conf' => $this,
'direction' => $direction,
);
drupal_alter('ldap_user_attrs_list', $available_user_attrs[$direction], $params);
}
}
$this->synchMapping = $available_user_attrs;
cache_set('ldap_user_synch_mapping', $this->synchMapping);
}