Merge pull request #51111 from nextcloud/backport/47513/stable31

This commit is contained in:
Kate 2025-03-03 10:37:38 +01:00 committed by GitHub
commit b46f010c1e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 2 additions and 18 deletions

View file

@ -956,22 +956,6 @@ class Access extends LDAPUtility {
}
$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;

View file

@ -665,7 +665,7 @@ class AccessTest extends TestCase {
$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);

View file

@ -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