From 4b75668c5e972c4ca1ee8d0dea9ffef907e185c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Tue, 9 Jul 2024 09:27:10 +0200 Subject: [PATCH] fix(user_ldap): Correctly cache that user exists to avoid a request on mapping new user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- apps/user_ldap/lib/Access.php | 1 + apps/user_ldap/lib/User/Manager.php | 2 -- apps/user_ldap/lib/User_LDAP.php | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php index a9fc2cac618bd..389d876719bb8 100644 --- a/apps/user_ldap/lib/Access.php +++ b/apps/user_ldap/lib/Access.php @@ -734,6 +734,7 @@ public function cacheUserHome(string $ocName, $home): void { */ public function cacheUserExists(string $ocName): void { $this->connection->writeToCache('userExists' . $ocName, true); + $this->connection->writeToCache('userExistsOnLDAP' . $ocName, true); } /** diff --git a/apps/user_ldap/lib/User/Manager.php b/apps/user_ldap/lib/User/Manager.php index 3695b4efd74cf..ead8e96f15c4e 100644 --- a/apps/user_ldap/lib/User/Manager.php +++ b/apps/user_ldap/lib/User/Manager.php @@ -265,9 +265,7 @@ public function exists($id): bool { if ($this->isDeletedUser($id)) { return true; } - $this->logger->debug('username2dn({id})', ['id' => $id]); $dn = $this->access->username2dn($id); - $this->logger->debug('end username2dn({id})', ['id' => $id]); if ($dn !== false) { return true; } diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php index 45119076f7040..80bc00623d3f9 100644 --- a/apps/user_ldap/lib/User_LDAP.php +++ b/apps/user_ldap/lib/User_LDAP.php @@ -471,7 +471,6 @@ public function getDisplayName($uid) { $this->access->connection->writeToCache($cacheKey, $displayName); } if ($user instanceof OfflineUser) { - /** @var OfflineUser $user*/ $displayName = $user->getDisplayName(); } return $displayName; @@ -618,7 +617,6 @@ public function createUser($username, $password) { $uuid, true ); - $this->access->cacheUserExists($username); } else { $this->logger->warning( 'Failed to map created LDAP user with userid {userid}, because UUID could not be determined',