[Pkg-owncloud-commits] [owncloud] 20/78: offset needs to be considered in computed limit
David Prévot
taffit at moszumanska.debian.org
Sun May 31 01:59:02 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit bf7e2c756f8095b7946e5e82c0909b891d475389
Author: Arthur Schiwon <blizzz at owncloud.com>
Date: Mon Mar 23 16:51:40 2015 +0100
offset needs to be considered in computed limit
---
apps/user_ldap/group_ldap.php | 2 +-
apps/user_ldap/tests/group_ldap.php | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/apps/user_ldap/group_ldap.php b/apps/user_ldap/group_ldap.php
index e8d268d..cba19f3 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 d1262e4..8066bce 100644
--- a/apps/user_ldap/tests/group_ldap.php
+++ b/apps/user_ldap/tests/group_ldap.php
@@ -294,4 +294,18 @@ class Test_Group_Ldap extends \PHPUnit_Framework_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));
+ }
+
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list