Add a config item to exclude some users from LDAP sync.

This commit is contained in:
Andrew McMillan 2010-02-25 21:19:08 +13:00
parent 110e05220a
commit 41766218a5
2 changed files with 13 additions and 4 deletions

View File

@ -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');

View File

@ -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)");