Skip to content

Commit

Permalink
fix(ldap): Fix user_ldap attribute casing to fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
  • Loading branch information
come-nc committed Jul 29, 2024
1 parent e681d82 commit f3e9cde
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions apps/user_ldap/lib/Access.php
Original file line number Diff line number Diff line change
Expand Up @@ -502,15 +502,15 @@ public function dn2ocname($fdn, $ldapName = null, $isUser = true, &$newlyMapped
}

if ($isUser) {
$nameAttribute = $this->connection->ldapUserDisplayName;
$nameAttribute = strtolower($this->connection->ldapUserDisplayName);
$filter = $this->connection->ldapUserFilter;
$uuidAttr = 'ldapUuidUserAttribute';
$uuidOverride = $this->connection->ldapExpertUUIDUserAttr;
$usernameAttribute = (string)$this->connection->ldapExpertUsernameAttr;
$usernameAttribute = strtolower($this->connection->ldapExpertUsernameAttr);
$attributesToRead = [$nameAttribute,$usernameAttribute];
// TODO fetch also display name attributes and cache them if the user is mapped
} else {
$nameAttribute = $this->connection->ldapGroupDisplayName;
$nameAttribute = strtolower($this->connection->ldapGroupDisplayName);
$filter = $this->connection->ldapGroupFilter;
$uuidAttr = 'ldapUuidGroupAttribute';
$uuidOverride = $this->connection->ldapExpertUUIDGroupAttr;
Expand Down
3 changes: 2 additions & 1 deletion apps/user_ldap/tests/AccessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,8 @@ public function testFetchListOfUsers() {

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

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

Expand Down

0 comments on commit f3e9cde

Please sign in to comment.