From c846104d9405f77f841a0dac5e3e56815d1aaf33 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Tue, 3 Jul 2012 23:45:20 +1200 Subject: [PATCH] Those damn numeric usernames will get you every time. --- inc/drivers_ldap.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/inc/drivers_ldap.php b/inc/drivers_ldap.php index bb0b2e75..0a6a0771 100644 --- a/inc/drivers_ldap.php +++ b/inc/drivers_ldap.php @@ -570,16 +570,19 @@ function sync_LDAP(){ // deactivating all users $params = array(); $i = 0; + $paramstring = ''; foreach( $users_to_deactivate AS $v ) { 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); } if ( count($params) > 0 ) { $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__); - Principal::cacheFlush('lower(username) IN ('.implode(',',array_keys($params)).')', $params); + Principal::cacheFlush('lower(username) IN ('.$paramstring.')', $params); } // updating all users