diff options
author | voxsim <Simon Vocella> | 2014-09-15 18:37:54 +0200 |
---|---|---|
committer | voxsim <Simon Vocella> | 2014-09-15 18:37:54 +0200 |
commit | 1366133d2bba33391b25a57ad0182b317fe3ecb6 (patch) | |
tree | 4264c6bad95599835580ff39b6bfa21ea899d2af /lib/private/group | |
parent | a49610e18a07d04dd3ed861e15b64a94b8a45e19 (diff) | |
download | nextcloud-server-1366133d2bba33391b25a57ad0182b317fe3ecb6.tar.gz nextcloud-server-1366133d2bba33391b25a57ad0182b317fe3ecb6.zip |
add more logic in displayNamesInGroup for big user bases
Diffstat (limited to 'lib/private/group')
-rw-r--r-- | lib/private/group/manager.php | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/private/group/manager.php b/lib/private/group/manager.php index 982a3ceec46..e3744ab7698 100644 --- a/lib/private/group/manager.php +++ b/lib/private/group/manager.php @@ -214,12 +214,23 @@ class Manager extends PublicEmitter { if(!empty($search)) { // only user backends have the capability to do a complex search for users - $filteredUsers = $this->userManager->search($search); - foreach($filteredUsers as $filteredUser) { - if($group->inGroup($filteredUser)) { - $groupUsers []= $filteredUser; - } + $searchOffset = 0; + if($limit === -1) { + $searchLimit = $group->count(''); + } else { + $searchLimit = $limit * 2; } + + do { + $filteredUsers = $this->userManager->search($search, $searchLimit, $searchOffset); + foreach($filteredUsers as $filteredUser) { + if($group->inGroup($filteredUser)) { + $groupUsers []= $filteredUser; + } + } + $searchOffset += $searchLimit; + } while(sizeof($groupUsers) < $searchLimit+$offset && sizeof($filteredUsers) > 0 && sizeof($filteredUsers) === $searchLimit); + if($limit === -1) { $groupUsers = array_slice($groupUsers, $offset); } else { |