LDAP: improve slicing

This commit is contained in:
Arthur Schiwon 2012-10-27 17:36:08 +02:00
parent 33aa630af3
commit 5b3c9518dc
1 changed files with 8 additions and 3 deletions

View File

@ -585,10 +585,14 @@ abstract class Access {
}
$findings = $selection;
}
if(!$this->pagedSearchedSuccessful
//we slice the findings, when
//a) paged search insuccessful, though attempted
//b) no paged search, but limit set
if((!$this->pagedSearchedSuccessful
&& $pagedSearchOK)
|| (
!is_null($limit)
|| !is_null($offset)
!$pagedSearchOK
&& !is_null($limit)
)
) {
$findings = array_slice($findings, intval($offset), $limit);
@ -775,6 +779,7 @@ abstract class Access {
$pagedSearchOK = false;
if($this->connection->hasPagedResultSupport && !is_null($limit)) {
$offset = intval($offset); //can be null
\OCP\Util::writeLog('user_ldap', 'initializing paged search for Filter'.$filter.' base '.$base.' attr '.print_r($attr, true). ' limit ' .$limit.' offset '.$offset, \OCP\Util::DEBUG);
//get the cookie from the search for the previous search, required by LDAP
$cookie = $this->getPagedResultCookie($filter, $limit, $offset);
if(empty($cookie) && ($offset > 0)) {