Merge pull request #8216 from owncloud/usermanager_fix_limitoffset
Remove limit and offset manipulation when getting users or groups, be…
This commit is contained in:
commit
9de1cc52c0
|
@ -172,12 +172,6 @@ class Group {
|
|||
$users = array();
|
||||
foreach ($this->backends as $backend) {
|
||||
$userIds = $backend->usersInGroup($this->gid, $search, $limit, $offset);
|
||||
if (!is_null($limit)) {
|
||||
$limit -= count($userIds);
|
||||
}
|
||||
if (!is_null($offset)) {
|
||||
$offset -= count($userIds);
|
||||
}
|
||||
$users += $this->getVerifiedUsers($userIds);
|
||||
if (!is_null($limit) and $limit <= 0) {
|
||||
return array_values($users);
|
||||
|
@ -223,12 +217,6 @@ class Group {
|
|||
} else {
|
||||
$userIds = $backend->usersInGroup($this->gid, $search, $limit, $offset);
|
||||
}
|
||||
if (!is_null($limit)) {
|
||||
$limit -= count($userIds);
|
||||
}
|
||||
if (!is_null($offset)) {
|
||||
$offset -= count($userIds);
|
||||
}
|
||||
$users = $this->getVerifiedUsers($userIds);
|
||||
if (!is_null($limit) and $limit <= 0) {
|
||||
return array_values($users);
|
||||
|
|
|
@ -134,12 +134,6 @@ class Manager extends PublicEmitter {
|
|||
$groups = array();
|
||||
foreach ($this->backends as $backend) {
|
||||
$groupIds = $backend->getGroups($search, $limit, $offset);
|
||||
if (!is_null($limit)) {
|
||||
$limit -= count($groupIds);
|
||||
}
|
||||
if (!is_null($offset)) {
|
||||
$offset -= count($groupIds);
|
||||
}
|
||||
foreach ($groupIds as $groupId) {
|
||||
$groups[$groupId] = $this->getGroupObject($groupId);
|
||||
}
|
||||
|
|
|
@ -175,13 +175,6 @@ class Manager extends PublicEmitter {
|
|||
if (is_array($backendUsers)) {
|
||||
foreach ($backendUsers as $uid) {
|
||||
$users[] = $this->getUserObject($uid, $backend);
|
||||
if (!is_null($limit)) {
|
||||
$limit--;
|
||||
}
|
||||
if (!is_null($offset) and $offset > 0) {
|
||||
$offset--;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -211,13 +204,6 @@ class Manager extends PublicEmitter {
|
|||
if (is_array($backendUsers)) {
|
||||
foreach ($backendUsers as $uid => $displayName) {
|
||||
$users[] = $this->getUserObject($uid, $backend);
|
||||
if (!is_null($limit)) {
|
||||
$limit--;
|
||||
}
|
||||
if (!is_null($offset) and $offset > 0) {
|
||||
$offset--;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -287,7 +287,7 @@ class Group extends \PHPUnit_Framework_TestCase {
|
|||
->will($this->returnValue(array('user2')));
|
||||
$backend2->expects($this->once())
|
||||
->method('usersInGroup')
|
||||
->with('group1', 'user', 1, 0)
|
||||
->with('group1', 'user', 2, 1)
|
||||
->will($this->returnValue(array('user1')));
|
||||
|
||||
$users = $group->searchUsers('user', 2, 1);
|
||||
|
|
|
@ -254,7 +254,7 @@ class Manager extends \PHPUnit_Framework_TestCase {
|
|||
$backend2 = $this->getMock('\OC_Group_Database');
|
||||
$backend2->expects($this->once())
|
||||
->method('getGroups')
|
||||
->with('1', 1, 0)
|
||||
->with('1', 2, 1)
|
||||
->will($this->returnValue(array('group12')));
|
||||
$backend2->expects($this->any())
|
||||
->method('groupExists')
|
||||
|
|
|
@ -210,7 +210,7 @@ class Manager extends \PHPUnit_Framework_TestCase {
|
|||
$backend2 = $this->getMock('\OC_User_Dummy');
|
||||
$backend2->expects($this->once())
|
||||
->method('getUsers')
|
||||
->with($this->equalTo('fo'), $this->equalTo(1), $this->equalTo(0))
|
||||
->with($this->equalTo('fo'), $this->equalTo(3), $this->equalTo(1))
|
||||
->will($this->returnValue(array('foo3')));
|
||||
|
||||
$manager = new \OC\User\Manager();
|
||||
|
|
Loading…
Reference in New Issue