From 3f1a90b4341d7583f89e16040d78a58f7a8759a8 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Wed, 24 Apr 2024 12:24:06 -0100 Subject: [PATCH] reverse getToken() Signed-off-by: Maxence Lange --- lib/Db/UserMapper.php | 4 ++-- lib/Model/Acl.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Db/UserMapper.php b/lib/Db/UserMapper.php index 2a1fd4c96..6a2e03ec9 100644 --- a/lib/Db/UserMapper.php +++ b/lib/Db/UserMapper.php @@ -89,7 +89,7 @@ public function getCurrentUser(): UserBase { $this->currentUser = $this->getUserFromUserBase($this->userSession->getUser()->getUID()); } else { try { - $this->currentUser = $this->getUserFromShareToken($this->getSessionStoredShareToken()); + $this->currentUser = $this->getUserFromShareToken($this->getToken()); } catch (DoesNotExistException $e) { $this->logger->debug('no user found, returned fake user'); $this->currentUser = new GenericUser('', Share::TYPE_PUBLIC); @@ -103,7 +103,7 @@ public function getCurrentUserCached(): UserBase { return $this->currentUser ?? $this->getCurrentUser(); } - public function getSessionStoredShareToken(): string { + private function getToken(): string { return (string) $this->session->get(AppConstants::SESSION_KEY_SHARE_TOKEN); } diff --git a/lib/Model/Acl.php b/lib/Model/Acl.php index f9522a86d..e4ea7087e 100644 --- a/lib/Model/Acl.php +++ b/lib/Model/Acl.php @@ -140,8 +140,8 @@ public function getCurrentUserArray(): array { * Set poll id and load poll */ public function setPollId(?int $pollId = null, string $permission = self::PERMISSION_POLL_VIEW): Acl { - if ($this->getSessionStoredShareToken() && $pollId !== $this->getShare()->getPollId()) { - $this->logger->warning('Ignoring requested pollId ' . $pollId . '. Keeping share pollId of share(' . $this->getSessionStoredShareToken() . '): ' . $this->getShare()->getPollId()); + if ($this->getToken() && $pollId !== $this->getShare()->getPollId()) { + $this->logger->warning('Ignoring requested pollId ' . $pollId . '. Keeping share pollId of share(' . $this->getToken() . '): ' . $this->getShare()->getPollId()); } else { $this->pollId = $pollId; } @@ -273,7 +273,7 @@ public function getPollId(): int { return (int) $this->getPoll()->getId(); } - private function getSessionStoredShareToken(): ?string { + public function getToken(): ?string { return $this->session->get(AppConstants::SESSION_KEY_SHARE_TOKEN); }