diff options
author | macjohnny <estebanmarin@gmx.ch> | 2014-06-12 14:49:15 +0200 |
---|---|---|
committer | macjohnny <estebanmarin@gmx.ch> | 2014-06-12 14:49:15 +0200 |
commit | 482eded8b31b257dfed7761c7cb43f35ddcd3408 (patch) | |
tree | 6a6b765ff4e44a6c82bdc5e8cf0bee949b4c3bb5 | |
parent | 354cace14ae01e7ff34af3c8a4a3335b89596da3 (diff) | |
parent | e8e2e47e6891276a260d465a4ef50c8ddc2ad8ce (diff) | |
download | nextcloud-server-482eded8b31b257dfed7761c7cb43f35ddcd3408.tar.gz nextcloud-server-482eded8b31b257dfed7761c7cb43f35ddcd3408.zip |
Merge pull request #8998 from macjohnny/master
drastic speedup for nested ldap groups
-rw-r--r-- | lib/private/group.php | 7 | ||||
-rw-r--r-- | lib/private/group/manager.php | 12 |
2 files changed, 13 insertions, 6 deletions
diff --git a/lib/private/group.php b/lib/private/group.php index 8dc38129205..bd9e3d37d1f 100644 --- a/lib/private/group.php +++ b/lib/private/group.php @@ -187,12 +187,7 @@ class OC_Group { public static function getUserGroups($uid) { $user = self::$userManager->get($uid); if ($user) { - $groups = self::getManager()->getUserGroups($user); - $groupIds = array(); - foreach ($groups as $group) { - $groupIds[] = $group->getGID(); - } - return $groupIds; + return self::getManager()->getUserGroupIds($user); } else { return array(); } diff --git a/lib/private/group/manager.php b/lib/private/group/manager.php index dae6443e9d4..3613c7547bd 100644 --- a/lib/private/group/manager.php +++ b/lib/private/group/manager.php @@ -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 |