From b531f5d086103ce66f6db144b577d85b305af2a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Thu, 25 Jul 2024 11:12:45 +0200 Subject: [PATCH] chore: Switch to new API to set volatile user to prevent persisting it in any case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/Service/UserScopeService.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Service/UserScopeService.php b/lib/Service/UserScopeService.php index 88fd3eacb1..d6c72a217b 100644 --- a/lib/Service/UserScopeService.php +++ b/lib/Service/UserScopeService.php @@ -50,7 +50,13 @@ public function setUserScope(string $uid = null): void { if ($user === null) { throw new InvalidArgumentException('No user found for the uid ' . $uid); } - $this->userSession->setUser($user); + + /** @psalm-suppress RedundantCondition */ + if (method_exists($this->userSession, 'setVolatileActiveUser')) { + $this->userSession->setVolatileActiveUser($user); + } else { + $this->userSession->setUser($user); + } } /**