Work on "Sync LDAP with RSCDS" feature.

* Use an ugly hack so that users that are updated using the Sync
  LDAP feature retain their user_no.  Otherwise a new user_no
  was selected, and the insert failed since the username already
  existed.
* Tidy up the output messages to be more consistent.
* Only display "updating user records" if users were updated.
This commit is contained in:
Andrew Ruthven 2008-02-13 12:33:27 +13:00 committed by Andrew Ruthven
parent de50126b6e
commit 0bc51a9e39

View File

@ -349,7 +349,7 @@ function sync_LDAP(){
$usr_in .= ', ' . qpg($v);
}
$usr_in = substr($usr_in,1);
$c->messages[] = sprintf(i18n('- deactivating users : %s'),$usr_in);
$c->messages[] = sprintf(i18n('- deactivating users : %s'),join(', ',$users_to_deactivate));
$qry = new PgQuery( "UPDATE usr SET active = FALSE WHERE lower(username) IN ($usr_in)");
$qry->Exec('sync_LDAP',__LINE__,__FILE__);
}
@ -360,6 +360,9 @@ function sync_LDAP(){
$valid=$ldap_users_info[$username];
$ldap_timestamp = $valid[$mapping["updated"]];
$valid["user_no"] = $db_users_info[$username]["user_no"];
$mapping["user_no"] = "user_no";
/**
* This splits the LDAP timestamp apart and assigns values to $Y $m $d $H $M and $S
*/
@ -377,9 +380,10 @@ function sync_LDAP(){
$users_nothing_done[] = $username;
}
}
$c->messages[] = sprintf(i18n('- updating user record %s'),join(', ',$users_to_update));
if ( sizeof($users_to_update) )
$c->messages[] = sprintf(i18n('- updating user records : %s'),join(', ',$users_to_update));
if ( sizeof($users_nothing_done) )
$c->messages[] = sprintf(i18n('- nothing done on %s'),join(', ', $users_nothing_done));
$c->messages[] = sprintf(i18n('- nothing done on : %s'),join(', ', $users_nothing_done));
}
}
}