Merge pull request #8998 from macjohnny/master
drastic speedup for nested ldap groups
This commit is contained in:
commit
482eded8b3
|
@ -187,12 +187,7 @@ class OC_Group {
|
||||||
public static function getUserGroups($uid) {
|
public static function getUserGroups($uid) {
|
||||||
$user = self::$userManager->get($uid);
|
$user = self::$userManager->get($uid);
|
||||||
if ($user) {
|
if ($user) {
|
||||||
$groups = self::getManager()->getUserGroups($user);
|
return self::getManager()->getUserGroupIds($user);
|
||||||
$groupIds = array();
|
|
||||||
foreach ($groups as $group) {
|
|
||||||
$groupIds[] = $group->getGID();
|
|
||||||
}
|
|
||||||
return $groupIds;
|
|
||||||
} else {
|
} else {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,6 +182,18 @@ class Manager extends PublicEmitter {
|
||||||
$this->cachedUserGroups[$uid] = array_values($groups);
|
$this->cachedUserGroups[$uid] = array_values($groups);
|
||||||
return $this->cachedUserGroups[$uid];
|
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
|
* get a list of all display names in a group
|
||||||
|
|
Loading…
Reference in New Issue