fetches all users of a group at once from sql backend
authorPhilipp Schüle <p.schuele@metaways.de>
Thu, 7 Aug 2014 11:13:14 +0000 (13:13 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 7 Aug 2014 11:31:53 +0000 (13:31 +0200)
* this should drastically improve performance here, as all users had
been fetched one by one and even from the sync backend before ...

Change-Id: I8c0bb150c99c15c8fe45d5bbee94872073f6f933
Reviewed-on: http://gerrit.tine20.com/customers/945
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Admin/Frontend/Json.php

index 5b7b369..2363a51 100644 (file)
@@ -608,17 +608,16 @@ class Admin_Frontend_Json extends Tinebase_Frontend_Json_Abstract
         
         if ($groupId) {
             $accountIds = Admin_Controller_Group::getInstance()->getGroupMembers($groupId);
-    
+            $users = Tinebase_User::getInstance()->getMultiple($accountIds);
             $result['results'] = array();
-            foreach ($accountIds as $accountId) {
-                $account = Tinebase_User::getInstance()->getUserById($accountId);
+            foreach ($users as $user) {
                 $result['results'][] = array(
-                    'id'        => $accountId,
+                    'id'        => $user->getId(),
                     'type'      => Tinebase_Acl_Rights::ACCOUNT_TYPE_USER,
-                    'name'      => $account->accountDisplayName,
+                    'name'      => $user->accountDisplayName,
                 );
             }
-                    
+            
             $result['totalcount'] = count($result['results']);
         }