Skip to content

Commit

Permalink
fix: Bring back actually setting the guest name
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr authored and backportbot[bot] committed May 8, 2024
1 parent 02f5e2f commit a3f56d3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
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->getUrlSrc($file->getMimeType())['urlsrc'];
}
Expand Down

0 comments on commit a3f56d3

Please sign in to comment.