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); + } } /**