Révision 7547bb19
Ajouté par Assos Assos il y a environ 7 ans
drupal7/sites/all/modules/ldap/ldap_user/ldap_user.module | ||
---|---|---|
595 | 595 |
$drupal_username = $form_state['values']['name']; |
596 | 596 |
|
597 | 597 |
if ($values['ldap_user_association'] == LDAP_USER_MANUAL_ACCT_CONFLICT_NO_LDAP_ASSOCIATE) { |
598 |
$form_state['values']['ldap_user_ldap_exclude']['und'][0]['value'] = 1;
|
|
598 |
$form_state['values']['ldap_user_ldap_exclude'][LANGUAGE_NONE][0]['value'] = 1;
|
|
599 | 599 |
} |
600 | 600 |
|
601 | 601 |
// if corresponding ldap account doesn't exist and provision not selected and make ldap associated is selected, throw error |
... | ... | |
668 | 668 |
} |
669 | 669 |
|
670 | 670 |
// exclude users who have the field ldap_user_ldap_exclude set to 1 |
671 |
if (is_object($account) && isset($account->ldap_user_ldap_exclude['und'][0]['value'])
|
|
671 |
if (is_object($account) && isset($account->ldap_user_ldap_exclude[LANGUAGE_NONE][0]['value'])
|
|
672 | 672 |
&& $account->ldap_user_ldap_exclude[LANGUAGE_NONE][0]['value'] == 1) { |
673 | 673 |
return TRUE; |
674 | 674 |
} |
675 | 675 |
|
676 | 676 |
// exclude new users who have the value set to 1 in their $edit array |
677 |
if (is_array($edit) && isset($edit['ldap_user_ldap_exclude']['und'][0]['value'])
|
|
677 |
if (is_array($edit) && isset($edit['ldap_user_ldap_exclude'][LANGUAGE_NONE][0]['value'])
|
|
678 | 678 |
&& $edit['ldap_user_ldap_exclude'][LANGUAGE_NONE][0]['value'] == 1) { |
679 | 679 |
return TRUE; |
680 | 680 |
} |
... | ... | |
693 | 693 |
* |
694 | 694 |
* @return boolean if user is ldap associated |
695 | 695 |
*/ |
696 |
|
|
697 | 696 |
function ldap_user_is_ldap_associated($account, $direction = NULL) { |
698 | 697 |
|
699 | 698 |
$to_drupal_user = FALSE; |
... | ... | |
701 | 700 |
|
702 | 701 |
if ($direction === NULL || $direction == LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER) { |
703 | 702 |
|
704 |
if (property_exists($account, 'ldap_user_current_dn') && !empty($account->ldap_user_current_dn['und'][0]['value'])) {
|
|
703 |
if (property_exists($account, 'ldap_user_current_dn') && !empty($account->ldap_user_current_dn[LANGUAGE_NONE][0]['value'])) {
|
|
705 | 704 |
$to_drupal_user = TRUE; |
706 | 705 |
} |
707 | 706 |
elseif (isset($account->uid)) { |
708 |
$authname = ldap_user_get_authname($account->uid);
|
|
707 |
$authname = ldap_user_get_authname($account); |
|
709 | 708 |
$to_drupal_user = (boolean)$authname; |
710 | 709 |
} |
711 | 710 |
} |
712 | 711 |
|
713 | 712 |
if ($direction === NULL || $direction == LDAP_USER_PROV_DIRECTION_TO_LDAP_ENTRY) { |
714 |
if (property_exists($account, 'ldap_user_prov_entries') && !empty($account->ldap_user_prov_entries['und'][0]['value'])) {
|
|
713 |
if (property_exists($account, 'ldap_user_prov_entries') && !empty($account->ldap_user_prov_entries[LANGUAGE_NONE][0]['value'])) {
|
|
715 | 714 |
$to_ldap_entry = TRUE; |
716 | 715 |
} |
717 | 716 |
} |
... | ... | |
1184 | 1183 |
switch ($type) { |
1185 | 1184 |
|
1186 | 1185 |
case 'field': |
1187 |
if (isset( $user_entity->{$attr}['und'][$ordinal]['value'])) {
|
|
1188 |
$tokens[$token] = $user_entity->{$attr}['und'][$ordinal]['value'];
|
|
1186 |
if (isset( $user_entity->{$attr}[LANGUAGE_NONE][$ordinal]['value'])) {
|
|
1187 |
$tokens[$token] = $user_entity->{$attr}[LANGUAGE_NONE][$ordinal]['value'];
|
|
1189 | 1188 |
} |
1190 | 1189 |
break; |
1191 | 1190 |
|
... | ... | |
1248 | 1247 |
} |
1249 | 1248 |
|
1250 | 1249 |
/** |
1251 |
* Returns LDAP authname from the authmap table for a variant input |
|
1250 |
* Returns LDAP authname from the authmap table for a variant input.
|
|
1252 | 1251 |
* |
1253 | 1252 |
* @param $data |
1254 | 1253 |
* A variant input. Allowed variable types: |
1255 | 1254 |
* - object: user account object |
1256 |
* - integer: user id |
|
1257 | 1255 |
* - string: username |
1256 |
* |
|
1257 |
* @return string|NULL |
|
1258 |
* Returns the LDAP authname of the passed Drupal user. |
|
1258 | 1259 |
*/ |
1259 | 1260 |
function ldap_user_get_authname($data) { |
1260 | 1261 |
$cache = &drupal_static(__FUNCTION__, array()); |
... | ... | |
1268 | 1269 |
$uid = $data->uid; |
1269 | 1270 |
} |
1270 | 1271 |
} |
1271 |
elseif (is_numeric($data) && intval($data) == $data) { |
|
1272 |
// Integer - set uid number is an integer > 0 |
|
1273 |
if ($data > 0) { |
|
1274 |
$uid = $data; |
|
1275 |
} |
|
1276 |
} |
|
1277 |
elseif (is_string($data)) { |
|
1272 |
else { |
|
1278 | 1273 |
// String - load account and set uid if uid > 0 |
1279 | 1274 |
$account = user_load_by_name($data); |
1280 | 1275 |
if (!empty($account->uid)) { |
Formats disponibles : Unified diff
Weekly update of contrib modules