Skip to content

Commit 2dcb487

Browse files
committed
feat: Fetch groups in batch in getUserGroups
Signed-off-by: Carl Schwan <carlschwan@kde.org>
1 parent 60f4e84 commit 2dcb487

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

lib/private/Group/Manager.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -312,13 +312,10 @@ public function getUserGroups(?IUser $user = null): array {
312312
public function getUserIdGroups(string $uid): array {
313313
$groups = [];
314314

315-
foreach ($this->getUserIdGroupIds($uid) as $groupId) {
316-
$aGroup = $this->get($groupId);
317-
if ($aGroup instanceof IGroup) {
318-
$groups[$groupId] = $aGroup;
319-
} else {
320-
$this->logger->debug('User "' . $uid . '" belongs to deleted group: "' . $groupId . '"', ['app' => 'core']);
321-
}
315+
$groupIds = $this->getUserIdGroupIds($uid);
316+
$newGroups = $this->getGroupsObjects($groupIds);
317+
foreach ($newGroups as $groupId => $group) {
318+
$groups[$groupId] = $group;
322319
}
323320

324321
return $groups;

0 commit comments

Comments
 (0)