Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ONLYOFFICE/onlyoffice-nextcloud.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntipkin-A <Artem.Antipkin@onlyoffice.com>2022-09-09 13:29:41 +0300
committerAntipkin-A <Artem.Antipkin@onlyoffice.com>2022-09-09 13:29:41 +0300
commit2fac82e4e17ff4ea1efef56d7a5885cbdca26365 (patch)
tree5b578c9c0020e2c63b0aa885560951650fb3be91
parent540eff48cc661da02338d44f94c8c467ab5a070f (diff)
checking download attribute to download (Fix #687)feature/share-download
-rw-r--r--controller/editorcontroller.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/controller/editorcontroller.php b/controller/editorcontroller.php
index 80b25d3..92e7b60 100644
--- a/controller/editorcontroller.php
+++ b/controller/editorcontroller.php
@@ -1048,6 +1048,17 @@ class EditorController extends Controller {
}
}
+ $fileStorage = $file->getStorage();
+ if ($fileStorage->instanceOfStorage("\OCA\Files_Sharing\SharedStorage")) {
+ if (method_exists(IShare::class, "getAttributes")) {
+ $share = empty($share) ? $fileStorage->getShare() : $share;
+ $attributes = $share->getAttributes();
+ if ($attributes !== null && !$attributes->getAttribute("permissions", "download")) {
+ return $this->renderError($this->trans->t("Not permitted"));
+ }
+ }
+ }
+
$fileName = $file->getName();
$ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
$toExtension = strtolower($toExtension);