diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php index 77679ccc948ea..ff9ed6d7747df 100644 --- a/apps/user_ldap/lib/Access.php +++ b/apps/user_ldap/lib/Access.php @@ -958,22 +958,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): void { - $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 5b824a89e9688..dba6e5480d57c 100644 --- a/apps/user_ldap/tests/AccessTest.php +++ b/apps/user_ldap/tests/AccessTest.php @@ -667,7 +667,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); diff --git a/build/integration/openldap_features/openldap-uid-username.feature b/build/integration/openldap_features/openldap-uid-username.feature index 9d5405e88bf62..bee4098972b82 100644 --- a/build/integration/openldap_features/openldap-uid-username.feature +++ b/build/integration/openldap_features/openldap-uid-username.feature @@ -151,6 +151,7 @@ Feature: LDAP | ldapAttributesForUserSearch | employeeNumber | | useMemberOfToDetectMembership | 1 | And parameter "shareapi_only_share_with_group_members" of app "core" is set to "yes" + And invoking occ with "ldap:check-group cn=Orcharding,ou=OtherGroups,dc=nextcloud,dc=ci --update" And As an "alice" When getting sharees for # "5" is part of the employee number of some LDAP records @@ -162,4 +163,3 @@ Feature: LDAP And "users" sharees returned are | Elisa | 0 | elisa | And "exact groups" sharees returned is empty -