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

[stable28] Test guest name setting #3683

Merged
merged 5 commits into from
May 8, 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
2 changes: 2 additions & 0 deletions lib/Controller/DocumentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ public function token(int $fileId, ?string $shareToken = null, ?string $path = n

$wopi = $this->getToken($file, $share);

$this->tokenManager->setGuestName($wopi, $guestName);

return new DataResponse(array_merge(
[ 'urlSrc' => $this->tokenManager->getUrlSrc($file) ],
$wopi->jsonSerialize(),
Expand Down
9 changes: 9 additions & 0 deletions lib/TokenManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,15 @@ public function updateGuestName(string $accessToken, string $guestName) {
$this->wopiMapper->update($wopi);
}

public function setGuestName(Wopi $wopi, ?string $guestName = null): Wopi {
if ($wopi->getTokenType() !== Wopi::TOKEN_TYPE_GUEST && $wopi->getTokenType() !== Wopi::TOKEN_TYPE_REMOTE_GUEST) {
return $wopi;
}

$wopi->setGuestDisplayname($this->prepareGuestName($guestName));
return $this->wopiMapper->update($wopi);
}

public function getUrlSrc(File $file): string {
return $this->wopiParser->getUrlSrcValue($file->getMimeType());
}
Expand Down
Loading
Loading