summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormacjohnny <estebanmarin@gmx.ch>2014-06-12 14:49:15 +0200
committermacjohnny <estebanmarin@gmx.ch>2014-06-12 14:49:15 +0200
commit482eded8b31b257dfed7761c7cb43f35ddcd3408 (patch)
tree6a6b765ff4e44a6c82bdc5e8cf0bee949b4c3bb5
parent354cace14ae01e7ff34af3c8a4a3335b89596da3 (diff)
parente8e2e47e6891276a260d465a4ef50c8ddc2ad8ce (diff)
downloadnextcloud-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.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