Fix display of deactivated users after LDAP sync to not include those in $c->do_not_sync_from_ldap

...thus reducing the rate of heart attacks in DAViCal admins.

Also: ignore empty user objects that my LDAP server seems to generate.
This commit is contained in:
Florian Schlichting 2017-03-27 16:56:34 +02:00
parent 7ccc7c4491
commit f1ca12bbe9

View File

@ -594,6 +594,7 @@ function sync_LDAP(){
if ( sizeof($ldap_users_tmp) == 0 ) return;
foreach($ldap_users_tmp as $key => $ldap_user){
if(!isset($ldap_user[$mapping['username']])) continue;
$ldap_users_info[$ldap_user[$mapping['username']]] = $ldap_user;
unset($ldap_users_tmp[$key]);
}
@ -652,8 +653,12 @@ function sync_LDAP(){
$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;
foreach( $users_to_deactivate as $k => $v ) {
if ( isset($c->do_not_sync_from_ldap) && isset($c->do_not_sync_from_ldap[$v]) ) {
unset($users_to_deactivate[$k]);
$users_nothing_done[] = $v;
continue;
}
if ( $i > 0 ) $paramstring .= ',';
$paramstring .= ':u'.$i.'::text';
$params[':u'.$i++] = strtolower($v);