From 914861ac598c31c781a5aa14bbadfa47f80cb140 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Wed, 4 Nov 2009 11:17:06 +0000 Subject: [PATCH] bugfix groupmembers of groups got lost, while renaming accounts --- phpgwapi/inc/class.accounts_ldap.inc.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/phpgwapi/inc/class.accounts_ldap.inc.php b/phpgwapi/inc/class.accounts_ldap.inc.php index 040abb52f2..38d0ba05bc 100644 --- a/phpgwapi/inc/class.accounts_ldap.inc.php +++ b/phpgwapi/inc/class.accounts_ldap.inc.php @@ -697,7 +697,7 @@ class accounts_ldap $order = $propertyMap[$param['order']] ? $propertyMap[$param['order']] : 'uid'; $sri = ldap_search($this->ds, $this->user_context, $filter,array('uid', $order)); $fullSet = array(); - foreach (ldap_get_entries($this->ds, $sri) as $key => $entry) + foreach ((array)ldap_get_entries($this->ds, $sri) as $key => $entry) { if ($key !== 'count') $fullSet[$entry['uid'][0]] = $entry[$order][0]; } @@ -933,7 +933,7 @@ class accounts_ldap $sri = ldap_search($this->ds,$this->group_context,'(&(objectClass=posixGroup)(memberuid='.ldap::quote($account_lid).'))',array('cn','gidnumber')); $memberships = array(); - foreach(ldap_get_entries($this->ds, $sri) as $key => $data) + foreach((array)ldap_get_entries($this->ds, $sri) as $key => $data) { if ($key === 'count') continue; @@ -951,7 +951,12 @@ class accounts_ldap */ function members($gid) { - if (!is_numeric($gid)) return false; + if (!is_numeric($gid)) + { + // try to recover + $gid = $this->name2id($gid,'account_lid','g'); + if (!is_numeric($gid)) return false; + } $gid = abs($gid); // our gid is negative!