Skip to content

Commit

Permalink
reverse getToken()
Browse files Browse the repository at this point in the history
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
  • Loading branch information
ArtificialOwl committed Apr 24, 2024
1 parent 62f054e commit 3f1a90b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/Db/UserMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}

Expand Down
6 changes: 3 additions & 3 deletions lib/Model/Acl.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 3f1a90b

Please sign in to comment.