diff --git a/config/example-config.php b/config/example-config.php index 526d3779..8d10e0ee 100644 --- a/config/example-config.php +++ b/config/example-config.php @@ -245,6 +245,9 @@ $c->collections_always_exist = false; // // ); // +// /* If there is some user you do not want to sync from LDAP, put their user_no in this list */ +// $c->do_not_sync_from_ldap = array( 1 => true ); +// //include('drivers_ldap.php'); /* @@ -268,6 +271,10 @@ $c->collections_always_exist = false; // 'default_value' => array("date_format_type" => "E","locale" => "en_NZ"), // 'format_updated' => array('Y' => array(0,4),'m' => array(4,2),'d'=> array(6,2),'H' => array(8,2),'M'=>array(10,2),'S' => array(12,2)) // ); +// +// /* If there is some user you do not want to sync from LDAP, put their user_no in this list */ +// $c->do_not_sync_from_ldap = array( 1 => true ); +// //include('drivers_ldap.php'); diff --git a/inc/drivers_ldap.php b/inc/drivers_ldap.php index 392ceb73..1b6b22e2 100644 --- a/inc/drivers_ldap.php +++ b/inc/drivers_ldap.php @@ -379,10 +379,12 @@ function sync_LDAP(){ } // deactivating all users - if ( sizeof($users_to_deactivate) ) { - foreach( $users_to_deactivate AS $v ) { - $usr_in .= ', ' . qpg($v); - } + $usr_in = ''; + foreach( $users_to_deactivate AS $v ) { + if ( isset($c->do_not_sync_from_ldap) && isset($c->do_not_sync_from_ldap[$v]) ) continue; + $usr_in .= ($usr_in == '' ? '' : ', ') . qpg($v); + } + if ( $usr_in != '' ) { $usr_in = substr($usr_in,1); $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)");