diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-07-29 15:32:43 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-08-27 10:06:45 +0200 |
commit | fffba1c6af521c0f584d760c9cef99cbe034370f (patch) | |
tree | 9d3ba5ef1291237294007690874c576635e426d2 /apps/user_ldap | |
parent | d2bc636a79a0bb0fd1939255fe69f440df171da8 (diff) | |
download | nextcloud-server-fffba1c6af521c0f584d760c9cef99cbe034370f.tar.gz nextcloud-server-fffba1c6af521c0f584d760c9cef99cbe034370f.zip |
fix(ldap): Fix user_ldap attribute casing to fix tests
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/user_ldap')
-rw-r--r-- | apps/user_ldap/lib/Access.php | 6 | ||||
-rw-r--r-- | apps/user_ldap/tests/AccessTest.php | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php index fbce4092295..2a9bd06d29d 100644 --- a/apps/user_ldap/lib/Access.php +++ b/apps/user_ldap/lib/Access.php @@ -502,15 +502,15 @@ class Access extends LDAPUtility { } 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; diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php index 01219fb9f81..62c508fdb09 100644 --- a/apps/user_ldap/tests/AccessTest.php +++ b/apps/user_ldap/tests/AccessTest.php @@ -612,7 +612,8 @@ class AccessTest extends TestCase { $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); |