diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-06-20 16:13:59 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-06-20 16:13:59 +0200 |
commit | b980722e89fe8b9b1a312a2ef5de8dea7b9f663e (patch) | |
tree | 2f70151a6c3b97d45e5aba6c6b00f2c1d5e0dcb0 /apps | |
parent | b186cffdbe26ea3390e9ff35071b36a81f57c033 (diff) | |
download | nextcloud-server-b980722e89fe8b9b1a312a2ef5de8dea7b9f663e.tar.gz nextcloud-server-b980722e89fe8b9b1a312a2ef5de8dea7b9f663e.zip |
Fix paged search when offset is not a multiple of default page size
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/user_ldap/lib/Access.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php index a6c48f383d2..465a9d5cc16 100644 --- a/apps/user_ldap/lib/Access.php +++ b/apps/user_ldap/lib/Access.php @@ -1994,8 +1994,14 @@ class Access extends LDAPUtility { // to start from 0 to come to the desired page. cookie value // of '0' is valid, because 389ds $defaultPageSize = (int)$this->connection->ldapPagingSize; - $reOffset = ($offset - $defaultPageSize) < 0 ? 0 : $offset - $defaultPageSize; - $this->search($filter, $base, $attr, $defaultPageSize, $reOffset, true); + if ($offset < $defaultPageSize) { + /* Make a search with offset as page size and dismiss the result, to init the cookie */ + $this->search($filter, $base, $attr, $offset, 0, true); + } else { + /* Make a search for previous page and dismiss the result, to init the cookie */ + $reOffset = $offset - $defaultPageSize; + $this->search($filter, $base, $attr, $defaultPageSize, $reOffset, true); + } if (!$this->hasMoreResults()) { // when the cookie is reset with != 0 offset, there are no further // results, so stop. |