diff options
Diffstat (limited to 'apps/files_sharing/lib/ViewOnly.php')
-rw-r--r-- | apps/files_sharing/lib/ViewOnly.php | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/apps/files_sharing/lib/ViewOnly.php b/apps/files_sharing/lib/ViewOnly.php index 7b52d79f4d0..e075677248a 100644 --- a/apps/files_sharing/lib/ViewOnly.php +++ b/apps/files_sharing/lib/ViewOnly.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2019 ownCloud GmbH @@ -17,11 +18,9 @@ use OCP\Files\NotFoundException; */ class ViewOnly { - /** @var Folder */ - private $userFolder; - - public function __construct(Folder $userFolder) { - $this->userFolder = $userFolder; + public function __construct( + private Folder $userFolder, + ) { } /** @@ -88,20 +87,13 @@ class ViewOnly { } // Extract extra permissions - /** @var \OCA\Files_Sharing\SharedStorage $storage */ + /** @var SharedStorage $storage */ $share = $storage->getShare(); - $canDownload = true; - - // Check if read-only and on whether permission can download is both set and disabled. + // Check whether download-permission was denied (granted if not set) $attributes = $share->getAttributes(); - if ($attributes !== null) { - $canDownload = $attributes->getAttribute('permissions', 'download'); - } + $canDownload = $attributes?->getAttribute('permissions', 'download'); - if ($canDownload !== null && !$canDownload) { - return false; - } - return true; + return $canDownload !== false; } } |