bugfix groupmembers of groups got lost, while renaming accounts

This commit is contained in:
Klaus Leithoff 2009-11-04 11:20:20 +00:00
parent 501cee0d55
commit 54c8e21c61

View File

@ -697,7 +697,7 @@ class accounts_ldap
$order = $propertyMap[$param['order']] ? $propertyMap[$param['order']] : 'uid'; $order = $propertyMap[$param['order']] ? $propertyMap[$param['order']] : 'uid';
$sri = ldap_search($this->ds, $this->user_context, $filter,array('uid', $order)); $sri = ldap_search($this->ds, $this->user_context, $filter,array('uid', $order));
$fullSet = array(); $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]; 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')); $sri = ldap_search($this->ds,$this->group_context,'(&(objectClass=posixGroup)(memberuid='.ldap::quote($account_lid).'))',array('cn','gidnumber'));
$memberships = array(); $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; if ($key === 'count') continue;
@ -951,7 +951,12 @@ class accounts_ldap
*/ */
function members($gid) 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! $gid = abs($gid); // our gid is negative!