Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable6] reverse getToken() #3449

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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
Loading