Skip to content

Commit f3e9cde

Browse files
committed
fix(ldap): Fix user_ldap attribute casing to fix tests
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent e681d82 commit f3e9cde

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

apps/user_ldap/lib/Access.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,15 +502,15 @@ public function dn2ocname($fdn, $ldapName = null, $isUser = true, &$newlyMapped
502502
}
503503

504504
if ($isUser) {
505-
$nameAttribute = $this->connection->ldapUserDisplayName;
505+
$nameAttribute = strtolower($this->connection->ldapUserDisplayName);
506506
$filter = $this->connection->ldapUserFilter;
507507
$uuidAttr = 'ldapUuidUserAttribute';
508508
$uuidOverride = $this->connection->ldapExpertUUIDUserAttr;
509-
$usernameAttribute = (string)$this->connection->ldapExpertUsernameAttr;
509+
$usernameAttribute = strtolower($this->connection->ldapExpertUsernameAttr);
510510
$attributesToRead = [$nameAttribute,$usernameAttribute];
511511
// TODO fetch also display name attributes and cache them if the user is mapped
512512
} else {
513-
$nameAttribute = $this->connection->ldapGroupDisplayName;
513+
$nameAttribute = strtolower($this->connection->ldapGroupDisplayName);
514514
$filter = $this->connection->ldapGroupFilter;
515515
$uuidAttr = 'ldapUuidGroupAttribute';
516516
$uuidOverride = $this->connection->ldapExpertUUIDGroupAttr;

apps/user_ldap/tests/AccessTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,8 @@ public function testFetchListOfUsers() {
612612

613613
$this->prepareMocksForSearchTests($base, $fakeConnection, $fakeSearchResultResource, $fakeLdapEntries);
614614

615-
$this->connection->expects($this->exactly($fakeLdapEntries['count']))
615+
// Called twice per user, for userExists and userExistsOnLdap
616+
$this->connection->expects($this->exactly(2 * $fakeLdapEntries['count']))
616617
->method('writeToCache')
617618
->with($this->stringStartsWith('userExists'), true);
618619

0 commit comments

Comments
 (0)