From 2dcb4872dd55f71caccef50ad9172b478bea5924 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Wed, 8 Jul 2026 15:59:23 +0200 Subject: [PATCH] feat: Fetch groups in batch in getUserGroups Signed-off-by: Carl Schwan --- lib/private/Group/Manager.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/private/Group/Manager.php b/lib/private/Group/Manager.php index 4dddfb3ed3779..295b6438b1c7f 100644 --- a/lib/private/Group/Manager.php +++ b/lib/private/Group/Manager.php @@ -312,13 +312,10 @@ public function getUserGroups(?IUser $user = null): array { public function getUserIdGroups(string $uid): array { $groups = []; - foreach ($this->getUserIdGroupIds($uid) as $groupId) { - $aGroup = $this->get($groupId); - if ($aGroup instanceof IGroup) { - $groups[$groupId] = $aGroup; - } else { - $this->logger->debug('User "' . $uid . '" belongs to deleted group: "' . $groupId . '"', ['app' => 'core']); - } + $groupIds = $this->getUserIdGroupIds($uid); + $newGroups = $this->getGroupsObjects($groupIds); + foreach ($newGroups as $groupId => $group) { + $groups[$groupId] = $group; } return $groups;