Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(user_ldap): Correctly cache that user exists to avoid a request o…
…n mapping new user

Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc committed Aug 27, 2024
commit d2bc636a79a0bb0fd1939255fe69f440df171da8
1 change: 1 addition & 0 deletions apps/user_ldap/lib/Access.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
2 changes: 0 additions & 2 deletions apps/user_ldap/lib/User/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 0 additions & 2 deletions apps/user_ldap/lib/User_LDAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ public function getDisplayName($uid) {
$this->access->connection->writeToCache($cacheKey, $displayName);
}
if ($user instanceof OfflineUser) {
/** @var OfflineUser $user */
$displayName = $user->getDisplayName();
}
return $displayName;
Expand Down Expand Up @@ -610,7 +609,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',
Expand Down