Révision bc175c27
Ajouté par Assos Assos il y a plus de 5 ans
drupal7/sites/all/modules/ldap/ldap_user/LdapUserConf.class.php | ||
---|---|---|
311 | 311 |
if (!$sid || !$this->drupalAcctProvisionServer) { |
312 | 312 |
return FALSE; |
313 | 313 |
} |
314 |
elseif ($this->ldapEntryProvisionServer == $sid) {
|
|
314 |
elseif ($this->drupalAcctProvisionServer == $sid) {
|
|
315 | 315 |
return TRUE; |
316 | 316 |
} |
317 | 317 |
else { |
... | ... | |
350 | 350 |
if (count(array_intersect($prov_events, $detail['prov_events']))) { |
351 | 351 |
// Add the attribute to our array. |
352 | 352 |
if ($detail['ldap_attr']) { |
353 |
ldap_servers_token_extract_attributes($required_attributes, $detail['ldap_attr']);
|
|
353 |
ldap_servers_token_extract_attributes($required_attributes, $detail['ldap_attr']); |
|
354 | 354 |
} |
355 | 355 |
} |
356 | 356 |
} |
... | ... | |
451 | 451 |
} |
452 | 452 |
$this->synchMapping = $available_user_attrs; |
453 | 453 |
|
454 |
cache_set('ldap_user_synch_mapping', $this->synchMapping);
|
|
454 |
cache_set('ldap_user_synch_mapping', $this->synchMapping); |
|
455 | 455 |
} |
456 | 456 |
|
457 | 457 |
/** |
... | ... | |
619 | 619 |
} |
620 | 620 |
if (!$ldap_user_prov_entry_exists) { |
621 | 621 |
$user_entity->ldap_user_prov_entries[LANGUAGE_NONE][] = array( |
622 |
'value' => $ldap_user_prov_entry,
|
|
622 |
'value' => $ldap_user_prov_entry, |
|
623 | 623 |
); |
624 | 624 |
|
625 | 625 |
// Save the field without calling user_save() |
... | ... | |
776 | 776 |
* $user_edit data returned by reference |
777 | 777 |
* |
778 | 778 |
*/ |
779 |
public function synchToDrupalAccount($drupal_user, &$user_edit, $prov_event = LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER, $ldap_user = NULL, $save = FALSE) {
|
|
780 |
|
|
779 |
public function synchToDrupalAccount($drupal_user, &$user_edit, $prov_event = LDAP_USER_EVENT_SYNCH_TO_DRUPAL_USER, $ldap_user = NULL, $save = FALSE) { |
|
780 |
|
|
781 | 781 |
$debug = array( |
782 | 782 |
'account' => $drupal_user, |
783 | 783 |
'user_edit' => $user_edit, |
... | ... | |
980 | 980 |
/** |
981 | 981 |
* 4. call drupal_alter() to allow other modules to alter $ldap_user |
982 | 982 |
*/ |
983 |
|
|
983 |
$params['account'] = $account; |
|
984 | 984 |
drupal_alter('ldap_entry', $ldap_user_entry, $params); |
985 | 985 |
|
986 | 986 |
return array($ldap_user_entry, $result); |
... | ... | |
1074 | 1074 |
else { // create drupal account |
1075 | 1075 |
$this->entryToUserEdit($ldap_user, $user_edit, $ldap_server, LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER, array(LDAP_USER_EVENT_CREATE_DRUPAL_USER)); |
1076 | 1076 |
if ($save) { |
1077 |
$watchdog_tokens = array('%drupal_username' => $user_edit['name']);
|
|
1077 |
$watchdog_tokens = array('%drupal_username' => $user_edit['name']); |
|
1078 | 1078 |
if (empty($user_edit['name'])) { |
1079 | 1079 |
drupal_set_message(t('User account creation failed because of invalid, empty derived Drupal username.'), 'error'); |
1080 | 1080 |
watchdog('ldap_user', |
... | ... | |
1198 | 1198 |
} |
1199 | 1199 |
|
1200 | 1200 |
$drupal_username = $ldap_server->userUsernameFromLdapEntry($ldap_user['attr']); |
1201 |
if ($this->isSynched('[property.picture]', $prov_events, $direction)){ |
|
1202 |
|
|
1203 |
$picture = $ldap_server->userPictureFromLdapEntry($ldap_user['attr'], $drupal_username); |
|
1204 |
|
|
1205 |
if ($picture){ |
|
1206 |
$edit['picture'] = $picture; |
|
1207 |
if(isset($picture->md5Sum)){ |
|
1208 |
$edit['data']['ldap_user']['init']['thumb5md'] = $picture->md5Sum; |
|
1209 |
} |
|
1210 |
} |
|
1211 |
} |
|
1212 | 1201 |
|
1213 | 1202 |
if ($this->isSynched('[property.name]', $prov_events, $direction) && !isset($edit['name']) && $drupal_username) { |
1214 | 1203 |
$edit['name'] = $drupal_username; |
... | ... | |
1243 | 1232 |
); |
1244 | 1233 |
} |
1245 | 1234 |
|
1235 |
if ($this->isSynched('[property.picture]', $prov_events, $direction)) { |
|
1236 |
$picture = $ldap_server->userPictureFromLdapEntry($ldap_user['attr'], $drupal_username); |
|
1237 |
if ($picture) { |
|
1238 |
if (in_array(LDAP_USER_EVENT_CREATE_DRUPAL_USER, $prov_events)) { |
|
1239 |
$edit['picture'] = $picture->fid; |
|
1240 |
} else { |
|
1241 |
$edit['picture'] = $picture; |
|
1242 |
} |
|
1243 |
$edit['data']['ldap_user']['init']['thumb5md'] = $picture->md5Sum; |
|
1244 |
} |
|
1245 |
} |
|
1246 |
|
|
1246 | 1247 |
/** |
1247 | 1248 |
* basic $user ldap fields |
1248 | 1249 |
*/ |
Formats disponibles : Unified diff
Weekly update of contrib modules