fix/improve the filter handling for querying all accounts, due to problems with unlimited querys, and/or large groups

This commit is contained in:
Klaus Leithoff 2008-09-19 09:12:30 +00:00
parent 7b01f31d7d
commit e4c29d36fc

View File

@ -712,6 +712,14 @@ class accounts_ldap
$sortFn = $param['sort'] == 'DESC' ? 'arsort' : 'asort'; $sortFn = $param['sort'] == 'DESC' ? 'arsort' : 'asort';
$sortFn($fullSet); $sortFn($fullSet);
$relevantAccounts = is_numeric($start) ? array_slice(array_keys($fullSet), $start, $offset) : array_keys($fullSet); $relevantAccounts = is_numeric($start) ? array_slice(array_keys($fullSet), $start, $offset) : array_keys($fullSet);
// if we do not have a start, or want the members of a certain group, we want all, that way we dont want to or the uids
// since if we have a whole lot of members, it slows the query down
// if you work with very big groups, it may present a problem
if (is_numeric($start) || is_numeric($param['type'])) {
$filter = "(" . "&(objectclass=posixaccount)" . '(|(uid='.implode(')(uid=',$relevantAccounts).'))' . $this->account_filter . ")";
} else {
$filter = "(" . "&(objectclass=posixaccount)" . $this->account_filter . ")";
}
$filter = "(" . "&(objectclass=posixaccount)" . '(|(uid='.implode(')(uid=',$relevantAccounts).'))' . $this->account_filter . ")"; $filter = "(" . "&(objectclass=posixaccount)" . '(|(uid='.implode(')(uid=',$relevantAccounts).'))' . $this->account_filter . ")";
$filter = str_replace(array('%user','%domain'),array('*',$GLOBALS['egw_info']['user']['domain']),$filter); $filter = str_replace(array('%user','%domain'),array('*',$GLOBALS['egw_info']['user']['domain']),$filter);