From e4c29d36fc28774a955f4a12f1e17e775886af8b Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Fri, 19 Sep 2008 09:12:30 +0000 Subject: [PATCH] fix/improve the filter handling for querying all accounts, due to problems with unlimited querys, and/or large groups --- phpgwapi/inc/class.accounts_ldap.inc.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/phpgwapi/inc/class.accounts_ldap.inc.php b/phpgwapi/inc/class.accounts_ldap.inc.php index 067cef5576..0897db9ae9 100644 --- a/phpgwapi/inc/class.accounts_ldap.inc.php +++ b/phpgwapi/inc/class.accounts_ldap.inc.php @@ -712,6 +712,14 @@ class accounts_ldap $sortFn = $param['sort'] == 'DESC' ? 'arsort' : 'asort'; $sortFn($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 = str_replace(array('%user','%domain'),array('*',$GLOBALS['egw_info']['user']['domain']),$filter);