Merge pull request #9022 from owncloud/speedup-nested-ldap-groups

drastic speedup for nested ldap groups
This commit is contained in:
macjohnny 2014-06-16 07:50:53 +02:00
commit e5224782fa
2 changed files with 13 additions and 6 deletions

View File

@ -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();
}

View 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