diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2015-03-23 18:51:40 +0300 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2015-03-24 12:18:12 +0300 |
commit | 6e26b117b958354e23fbd1f960e820ff8d2e747c (patch) | |
tree | b09da3b12897e239d6126b6f1af5195cd930ae38 /apps | |
parent | 4149fc40c2bc0814a56e30a82ab64b10211fbce3 (diff) |
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 e8d268d3df2..cba19f3791c 100644 --- a/apps/user_ldap/group_ldap.php +++ b/apps/user_ldap/group_ldap.php @@ -630,7 +630,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 efd7f803f3b..8d15806be28 100644 --- a/apps/user_ldap/tests/group_ldap.php +++ b/apps/user_ldap/tests/group_ldap.php @@ -293,4 +293,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)); + } + } |