Skip to content
Browse files

auth/ldap - sync_users script bugfix x2: it was deleting fields that …

…were not supposed to be synched to ldap and it was failing to set auth_forcepasswordchange
  • Loading branch information...
1 parent f159f93 commit a705afc7da59b73158179bb88d1da9b69f373281 martinlanghoff committed Sep 2, 2005
Showing with 6 additions and 2 deletions.
  1. +6 −2 auth/ldap/lib.php
View
8 auth/ldap/lib.php
@@ -516,7 +516,11 @@ function auth_sync_users ($bulk_insert_records = 1000, $do_updates=1) {
$updatekeys = array();
foreach ($all_keys as $key) {
if (preg_match('/^field_updatelocal_(.+)$/',$key, $match)) {
- if ($pcfg->{$match[0]}) { // if it has a true value
+ // if we have a field to update it from
+ // and it must be updated 'onlogin' we
+ // update it on cron
+ if ( !empty($pcfg->{'field_map_'.$match[1]})
+ && $pcfg->{$match[0]} === 'onlogin') {
array_push($updatekeys, $match[1]); // the actual key name
}
}
@@ -608,7 +612,7 @@ function auth_sync_users ($bulk_insert_records = 1000, $do_updates=1) {
$CFG->debug=$old_debug;
$userobj = auth_ldap_update_user_record($user->username);
if(isset($CFG->{'auth_ldap_forcechangepassword'}) && $CFG->{'auth_ldap_forcechangepassword'}){
- set_user_preference('auth_forcepasswordchange', 1, $userobj);
+ set_user_preference('auth_forcepasswordchange', 1, $userobj->id);
}
// update course creators

0 comments on commit a705afc

Please sign in to comment.
Something went wrong with that request. Please try again.