diff options
author | blizzz <blizzz@owncloud.com> | 2015-03-23 17:50:24 +0100 |
---|---|---|
committer | blizzz <blizzz@owncloud.com> | 2015-03-23 17:50:24 +0100 |
commit | 8906158d3b6c0f0d3e120cccbe036a2d36f3cdbe (patch) | |
tree | ae44a2bbb25317827465d903acd757da4fea5237 /apps | |
parent | 02c0fe8d43d409797162b71dbacd1565976b128c (diff) | |
parent | 7520d0fb3d2ec6b64134f792be5a6657d764a8e6 (diff) | |
download | nextcloud-server-8906158d3b6c0f0d3e120cccbe036a2d36f3cdbe.tar.gz nextcloud-server-8906158d3b6c0f0d3e120cccbe036a2d36f3cdbe.zip |
Merge pull request #15123 from owncloud/fix_14098
offset needs to be considered in computed limit
Diffstat (limited to 'apps')
-rw-r--r-- | apps/user_ldap/group_ldap.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/tests/group_ldap.php | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/apps/user_ldap/group_ldap.php b/apps/user_ldap/group_ldap.php index 40d702360fb..5dc4f836904 100644 --- a/apps/user_ldap/group_ldap.php +++ b/apps/user_ldap/group_ldap.php @@ -673,7 +673,7 @@ class GROUP_LDAP extends BackendUtility implements \OCP\GroupInterface { } $maxGroups = 100000; // limit max results (just for safety reasons) if ($limit > -1) { - $overallLimit = min($limit, $maxGroups); + $overallLimit = min($limit + $offset, $maxGroups); } else { $overallLimit = $maxGroups; } diff --git a/apps/user_ldap/tests/group_ldap.php b/apps/user_ldap/tests/group_ldap.php index 44f0f82c2f7..f2b16ee2eab 100644 --- a/apps/user_ldap/tests/group_ldap.php +++ b/apps/user_ldap/tests/group_ldap.php @@ -298,4 +298,18 @@ class Test_Group_Ldap extends \Test\TestCase { $groupBackend->inGroup($uid, $gid); } + public function testGetGroupsWithOffset() { + $access = $this->getAccessMock(); + $this->enableGroups($access); + + $access->expects($this->once()) + ->method('ownCloudGroupNames') + ->will($this->returnValue(array('group1', 'group2'))); + + $groupBackend = new GroupLDAP($access); + $groups = $groupBackend->getGroups('', 2, 2); + + $this->assertSame(2, count($groups)); + } + } |