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 <szymon.klos@collabora.com>
  • Loading branch information
eszkadev committed Jun 10, 2024
1 parent ab324d8 commit 25d53c6
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 @@ -197,13 +197,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 25d53c6

Please sign in to comment.