get only groupids in default share backend

instead of getting the full group object and then only using the id anyway

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2020-05-04 17:42:28 +02:00
parent afb12ddab1
commit 756fe45493
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
1 changed files with 2 additions and 7 deletions

View File

@ -888,7 +888,7 @@ class DefaultShareProvider implements IShareProvider {
$cursor->closeCursor(); $cursor->closeCursor();
} elseif ($shareType === \OCP\Share::SHARE_TYPE_GROUP) { } elseif ($shareType === \OCP\Share::SHARE_TYPE_GROUP) {
$user = $this->userManager->get($userId); $user = $this->userManager->get($userId);
$allGroups = $this->groupManager->getUserGroups($user); $allGroups = $this->groupManager->getUserGroupIds($user);
/** @var Share[] $shares2 */ /** @var Share[] $shares2 */
$shares2 = []; $shares2 = [];
@ -925,12 +925,7 @@ class DefaultShareProvider implements IShareProvider {
} }
$groups = array_filter($groups, function ($group) { $groups = array_filter($groups);
return $group instanceof IGroup;
});
$groups = array_map(function (IGroup $group) {
return $group->getGID();
}, $groups);
$qb->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_GROUP))) $qb->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_GROUP)))
->andWhere($qb->expr()->in('share_with', $qb->createNamedParameter( ->andWhere($qb->expr()->in('share_with', $qb->createNamedParameter(