]> source.dussan.org Git - nextcloud-server.git/commitdiff
Update manager.php
authormacjohnny <estebanmarin@gmx.ch>
Thu, 12 Jun 2014 07:41:23 +0000 (09:41 +0200)
committermacjohnny <estebanmarin@gmx.ch>
Thu, 12 Jun 2014 07:41:23 +0000 (09:41 +0200)
add a function getUserGroupIds for retrieving group ids instead of group objects. this significantly improves performance when using many (nested) groups.

lib/private/group/manager.php

index dae6443e9d488a61f80a756950e80ad80c273f04..150f4c18905d49bba94db4e9d987ca3211ecaa18 100644 (file)
@@ -182,6 +182,18 @@ class Manager extends PublicEmitter {
                $this->cachedUserGroups[$uid] = array_values($groups);
                return $this->cachedUserGroups[$uid];
        }
+       /**
+        * @param \OC\User\User $user
+        * @return array with group names
+        */
+       public function getUserGroupIds($user) {
+               $groupIds = array();
+               foreach ($this->backends as $backend) {
+                       $groupIds = array_merge($groupIds,$backend->getUserGroups($user->getUID()));
+                       
+               }
+               return $groupIds;
+       }
 
        /**
         * get a list of all display names in a group