Skip to content

Commit

Permalink
Use new property for admin user indication
Browse files Browse the repository at this point in the history
is_admin field inside UserExtraInfo is deprecated now.
We use dedicated IsAdminUser property in CheckFileInfo instead.
Leave old code for now for backward compatibility.

see: CollaboraOnline/online#9242

Signed-off-by: Szymon Kłos <[email protected]>
  • Loading branch information
eszkadev authored and backportbot[bot] committed Jun 12, 2024
1 parent c469347 commit 7c8bbc1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/Controller/WopiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,16 @@ public function checkFileInfo($fileId, $access_token) {
if ($user !== null) {
$response['UserExtraInfo']['avatar'] = $this->urlGenerator->linkToRouteAbsolute('core.avatar.getAvatar', ['userId' => $wopi->getEditorUid(), 'size' => self::WOPI_AVATAR_SIZE]);
if ($this->groupManager->isAdmin($wopi->getEditorUid())) {
$response['UserExtraInfo']['is_admin'] = true;
$response['UserExtraInfo']['is_admin'] = true; // DEPRECATED
$response['IsAdminUser'] = true;
} else {
$response['UserExtraInfo']['is_admin'] = false;
$response['UserExtraInfo']['is_admin'] = false; // DEPRECATED
$response['IsAdminUser'] = false;
}
} else {
$response['UserExtraInfo']['avatar'] = $this->urlGenerator->linkToRouteAbsolute('core.GuestAvatar.getAvatar', ['guestName' => urlencode($wopi->getGuestDisplayname()), 'size' => self::WOPI_AVATAR_SIZE]);
$response['UserExtraInfo']['is_admin'] = false;
$response['UserExtraInfo']['is_admin'] = false; // DEPRECATED
$response['IsAdminUser'] = false;
}

if ($isPublic) {
Expand Down

0 comments on commit 7c8bbc1

Please sign in to comment.