Those damn numeric usernames will get you every time.

This commit is contained in:
Andrew McMillan 2012-07-03 23:45:20 +12:00
parent a555fdad40
commit c846104d94

View File

@ -570,16 +570,19 @@ function sync_LDAP(){
// deactivating all users // deactivating all users
$params = array(); $params = array();
$i = 0; $i = 0;
$paramstring = '';
foreach( $users_to_deactivate AS $v ) { foreach( $users_to_deactivate AS $v ) {
if ( isset($c->do_not_sync_from_ldap) && isset($c->do_not_sync_from_ldap[$v]) ) continue; if ( isset($c->do_not_sync_from_ldap) && isset($c->do_not_sync_from_ldap[$v]) ) continue;
if ( $i > 0 ) $paramstring .= ',';
$paramstring .= ':u'.$i.'::text';
$params[':u'.$i++] = strtolower($v); $params[':u'.$i++] = strtolower($v);
} }
if ( count($params) > 0 ) { if ( count($params) > 0 ) {
$c->messages[] = sprintf(i18n('- deactivating users : %s'),join(', ',$users_to_deactivate)); $c->messages[] = sprintf(i18n('- deactivating users : %s'),join(', ',$users_to_deactivate));
$qry = new AwlQuery( 'UPDATE usr SET active = FALSE WHERE lower(username) IN ('.implode(',',array_keys($params)).')', $params); $qry = new AwlQuery( 'UPDATE usr SET active = FALSE WHERE lower(username) IN ('.$paramstring.')', $params);
$qry->Exec('sync_LDAP',__LINE__,__FILE__); $qry->Exec('sync_LDAP',__LINE__,__FILE__);
Principal::cacheFlush('lower(username) IN ('.implode(',',array_keys($params)).')', $params); Principal::cacheFlush('lower(username) IN ('.$paramstring.')', $params);
} }
// updating all users // updating all users