getGroups() $limit was not handled correctly

This commit is contained in:
root 2014-03-04 21:07:27 +01:00
parent eb59e63c3b
commit eb1e361824

View file

@ -353,10 +353,15 @@ class GROUP_LDAP extends BackendUtility implements \OCP\GroupInterface {
|| empty($pagingsize)) { || empty($pagingsize)) {
return $this->getGroupsChunk($search, $limit, $offset); return $this->getGroupsChunk($search, $limit, $offset);
} }
if ($limit > -1) {
$overall_limit = min($limit, 100000);
} else {
$overall_limit = 100000;
}
$chunk_offset = $offset; $chunk_offset = $offset;
$all_groups = array(); $all_groups = array();
while ($chunk_offset < $max_groups) { while ($chunk_offset < $overall_limit) {
$chunk_limit = min($pagingsize, $max_groups - $chunk_offset); $chunk_limit = min($pagingsize, $overall_limit - $chunk_offset);
$ldap_groups = $this->getGroupsChunk('', $chunk_limit, $chunk_offset); $ldap_groups = $this->getGroupsChunk('', $chunk_limit, $chunk_offset);
$nread = count($ldap_groups); $nread = count($ldap_groups);
\OCP\Util::writeLog('user_ldap', 'getAllGroups('.$search.'): read '.$nread.' at offset '.$chunk_offset.' (limit: '.$chunk_limit.')', \OCP\Util::DEBUG); \OCP\Util::writeLog('user_ldap', 'getAllGroups('.$search.'): read '.$nread.' at offset '.$chunk_offset.' (limit: '.$chunk_limit.')', \OCP\Util::DEBUG);