diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php index 81f3dc6cb707d..faaa648c9dec3 100644 --- a/apps/user_ldap/lib/Access.php +++ b/apps/user_ldap/lib/Access.php @@ -948,22 +948,6 @@ public function fetchListOfGroups(string $filter, array $attr, ?int $limit = nul } $groupRecords = $this->searchGroups($filter, $attr, $limit, $offset); - $listOfDNs = array_reduce($groupRecords, function ($listOfDNs, $entry) { - $listOfDNs[] = $entry['dn'][0]; - return $listOfDNs; - }, []); - $idsByDn = $this->getGroupMapper()->getListOfIdsByDn($listOfDNs); - - array_walk($groupRecords, function (array $record) use ($idsByDn) { - $newlyMapped = false; - $gid = $idsByDn[$record['dn'][0]] ?? null; - if ($gid === null) { - $gid = $this->dn2ocname($record['dn'][0], null, false, $newlyMapped, $record); - } - if (!$newlyMapped && is_string($gid)) { - $this->cacheGroupExists($gid); - } - }); $listOfGroups = $this->fetchList($groupRecords, $this->manyAttributes($attr)); $this->connection->writeToCache($cacheKey, $listOfGroups); return $listOfGroups; diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php index a9eeceeb86b3d..3e03f563d0609 100644 --- a/apps/user_ldap/tests/AccessTest.php +++ b/apps/user_ldap/tests/AccessTest.php @@ -665,7 +665,7 @@ public function testFetchListOfGroupsKnown(): void { $this->groupMapper->expects($this->never()) ->method('getNameByDN'); - $this->connection->expects($this->exactly(3)) + $this->connection->expects($this->exactly(1)) ->method('writeToCache'); $groups = $this->access->fetchListOfGroups($filter, $attributes);