summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormacjohnny <estebanmarin@gmx.ch>2014-06-16 07:50:53 +0200
committermacjohnny <estebanmarin@gmx.ch>2014-06-16 07:50:53 +0200
commite5224782fa4acb6f8f42aa437fb3f21c35e73e64 (patch)
treeee5ace64f6c95653c7995ab45f582d7a56bfc807 /lib
parent4d6fc6f3095f3d91ef7a55b7bc5ccafb82fd85f1 (diff)
parent767aa4e35ff4d8c9bd61996b15b286a86a9f92db (diff)
downloadnextcloud-server-e5224782fa4acb6f8f42aa437fb3f21c35e73e64.tar.gz
nextcloud-server-e5224782fa4acb6f8f42aa437fb3f21c35e73e64.zip
Merge pull request #9022 from owncloud/speedup-nested-ldap-groups
drastic speedup for nested ldap groups
Diffstat (limited to 'lib')
-rw-r--r--lib/private/group.php7
-rw-r--r--lib/private/group/manager.php12
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