diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b997e8e..02413487 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - offline viewer for share link - updatable list of supported formats - filling pdf instead oform +- fixed guest redirect when limiting the app to groups - fixed mobile editor size ## Added @@ -15,6 +16,7 @@ - opening a reference data source - changing a reference data source - setting for disable editors cron check +- support of user avatar in editor ## 8.2.3 ## Added diff --git a/appinfo/routes.php b/appinfo/routes.php index 0edcc195..cac20538 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -27,6 +27,7 @@ ["name" => "editor#download", "url" => "/downloadas", "verb" => "GET"], ["name" => "editor#index", "url" => "/{fileId}", "verb" => "GET"], ["name" => "editor#public_page", "url" => "/s/{shareToken}", "verb" => "GET"], + ["name" => "editor#user_info", "url" => "/ajax/userInfo", "verb" => "GET"], ["name" => "editor#users", "url" => "/ajax/users", "verb" => "GET"], ["name" => "editor#mention", "url" => "/ajax/mention", "verb" => "POST"], ["name" => "editor#reference", "url" => "/ajax/reference", "verb" => "POST"], diff --git a/controller/callbackcontroller.php b/controller/callbackcontroller.php index 58992b79..7e9b5f1b 100644 --- a/controller/callbackcontroller.php +++ b/controller/callbackcontroller.php @@ -42,6 +42,7 @@ use OCA\Onlyoffice\Crypt; use OCA\Onlyoffice\DocumentService; use OCA\Onlyoffice\FileVersions; +use OCA\Onlyoffice\FileUtility; use OCA\Onlyoffice\VersionManager; use OCA\Onlyoffice\KeyManager; use OCA\Onlyoffice\RemoteInstance; @@ -242,13 +243,24 @@ public function download($doc) { } $shareToken = isset($hashData->shareToken) ? $hashData->shareToken : null; - list($file, $error) = empty($shareToken) ? $this->getFile($userId, $fileId, null, $changes ? null : $version, $template) : $this->getFileByToken($fileId, $shareToken, $changes ? null : $version); + list($file, $error, $share) = empty($shareToken) ? $this->getFile($userId, $fileId, null, $changes ? null : $version, $template) : $this->getFileByToken($fileId, $shareToken, $changes ? null : $version); if (isset($error)) { return $error; } - if ($this->userSession->isLoggedIn() && !$file->isReadable()) { + $canDownload = true; + + $fileStorage = $file->getStorage(); + if ($fileStorage->instanceOfStorage("\OCA\Files_Sharing\SharedStorage") || !empty($shareToken)) { + $share = empty($share) ? $fileStorage->getShare() : $share; + $canDownload = FileUtility::canShareDownload($share); + if (!$canDownload && !empty($this->config->getDocumentServerSecret())) { + $canDownload = true; + } + } + + if ($this->userSession->isLoggedIn() && !$file->isReadable() || !$canDownload) { $this->logger->error("Download without access right", ["app" => $this->appName]); return new JSONResponse(["message" => $this->trans->t("Access denied")], Http::STATUS_FORBIDDEN); } @@ -504,7 +516,7 @@ public function track($doc, $users, $key, $status, $url, $token, $history, $chan \OC_Util::setupFS($userId); } - list($file, $error) = empty($shareToken) ? $this->getFile($userId, $fileId, $filePath) : $this->getFileByToken($fileId, $shareToken); + list($file, $error, $share) = empty($shareToken) ? $this->getFile($userId, $fileId, $filePath) : $this->getFileByToken($fileId, $shareToken); if (isset($error)) { $this->logger->error("track error: $fileId " . json_encode($error->getData()), ["app" => $this->appName]); @@ -613,7 +625,7 @@ function () use ($file, $newData) { */ private function getFile($userId, $fileId, $filePath = null, $version = 0, $template = false) { if (empty($fileId)) { - return [null, new JSONResponse(["message" => $this->trans->t("FileId is empty")], Http::STATUS_BAD_REQUEST)]; + return [null, new JSONResponse(["message" => $this->trans->t("FileId is empty")], Http::STATUS_BAD_REQUEST), null]; } try { @@ -621,12 +633,12 @@ private function getFile($userId, $fileId, $filePath = null, $version = 0, $temp $files = $folder->getById($fileId); } catch (\Exception $e) { $this->logger->logException($e, ["message" => "getFile: $fileId", "app" => $this->appName]); - return [null, new JSONResponse(["message" => $this->trans->t("Invalid request")], Http::STATUS_BAD_REQUEST)]; + return [null, new JSONResponse(["message" => $this->trans->t("Invalid request")], Http::STATUS_BAD_REQUEST), null]; } if (empty($files)) { $this->logger->error("Files not found: $fileId", ["app" => $this->appName]); - return [null, new JSONResponse(["message" => $this->trans->t("Files not found")], Http::STATUS_NOT_FOUND)]; + return [null, new JSONResponse(["message" => $this->trans->t("Files not found")], Http::STATUS_NOT_FOUND), null]; } $file = $files[0]; @@ -651,10 +663,10 @@ private function getFile($userId, $fileId, $filePath = null, $version = 0, $temp if ($owner !== null) { if ($owner->getUID() !== $userId) { - list($file, $error) = $this->getFile($owner->getUID(), $file->getId()); + list($file, $error, $share) = $this->getFile($owner->getUID(), $file->getId()); if (isset($error)) { - return [null, $error]; + return [null, $error, null]; } } @@ -667,7 +679,7 @@ private function getFile($userId, $fileId, $filePath = null, $version = 0, $temp } } - return [$file, null]; + return [$file, null, null]; } /** @@ -683,14 +695,14 @@ private function getFileByToken($fileId, $shareToken, $version = 0) { list($share, $error) = $this->getShare($shareToken); if (isset($error)) { - return [null, $error]; + return [null, $error, null]; } try { $node = $share->getNode(); } catch (NotFoundException $e) { $this->logger->logException($e, ["message" => "getFileByToken error", "app" => $this->appName]); - return [null, new JSONResponse(["message" => $this->trans->t("File not found")], Http::STATUS_NOT_FOUND)]; + return [null, new JSONResponse(["message" => $this->trans->t("File not found")], Http::STATUS_NOT_FOUND), null]; } if ($node instanceof Folder) { @@ -698,11 +710,11 @@ private function getFileByToken($fileId, $shareToken, $version = 0) { $files = $node->getById($fileId); } catch (\Exception $e) { $this->logger->logException($e, ["message" => "getFileByToken: $fileId", "app" => $this->appName]); - return [null, new JSONResponse(["message" => $this->trans->t("Invalid request")], Http::STATUS_NOT_FOUND)]; + return [null, new JSONResponse(["message" => $this->trans->t("Invalid request")], Http::STATUS_NOT_FOUND), null]; } if (empty($files)) { - return [null, new JSONResponse(["message" => $this->trans->t("File not found")], Http::STATUS_NOT_FOUND)]; + return [null, new JSONResponse(["message" => $this->trans->t("File not found")], Http::STATUS_NOT_FOUND), null]; } $file = $files[0]; } else { @@ -722,7 +734,7 @@ private function getFileByToken($fileId, $shareToken, $version = 0) { } } - return [$file, null]; + return [$file, null, $share]; } /** diff --git a/controller/editorapicontroller.php b/controller/editorapicontroller.php index 91558b84..3a13e3df 100644 --- a/controller/editorapicontroller.php +++ b/controller/editorapicontroller.php @@ -113,6 +113,13 @@ class EditorApiController extends OCSController { */ private $versionManager; + /** + * Avatar manager + * + * @var IAvatarManager + */ + private $avatarManager; + /** * Tag manager * @@ -167,6 +174,7 @@ public function __construct( $this->versionManager = new VersionManager($AppName, $root); $this->fileUtility = new FileUtility($AppName, $trans, $logger, $config, $shareManager, $session); + $this->avatarManager = \OC::$server->getAvatarManager(); } /** @@ -325,11 +333,8 @@ public function config($fileId, $filePath = null, $shareToken = null, $version = $storageShare = $fileStorage->getShare(); if (method_exists($storageShare, "getAttributes")) { $attributes = $storageShare->getAttributes(); - - $permissionsDownload = $attributes->getAttribute("permissions", "download"); - if ($permissionsDownload !== null) { - $params["document"]["permissions"]["download"] = $params["document"]["permissions"]["print"] = $params["document"]["permissions"]["copy"] = $permissionsDownload === true; - } + $canDownload = FileUtility::canShareDownload($storageShare); + $params["document"]["permissions"]["download"] = $params["document"]["permissions"]["print"] = $params["document"]["permissions"]["copy"] = $canDownload === true; if (isset($format["review"]) && $format["review"]) { $permissionsReviewOnly = $attributes->getAttribute($this->appName, "review"); @@ -436,6 +441,19 @@ public function config($fileId, $filePath = null, $shareToken = null, $version = "id" => $this->buildUserId($userId), "name" => $user->getDisplayName() ]; + $avatar = $this->avatarManager->getAvatar($userId); + if ($avatar->exists()) { + $userAvatarUrl = $this->urlGenerator->getAbsoluteURL( + $this->urlGenerator->linkToRoute( + "core.avatar.getAvatar", + [ + "userId" => $userId, + "size" => 64, + ] + ) + ); + $params["editorConfig"]["user"]["image"] = $userAvatarUrl; + } } $folderLink = null; diff --git a/controller/editorcontroller.php b/controller/editorcontroller.php index db269095..59dc6a81 100644 --- a/controller/editorcontroller.php +++ b/controller/editorcontroller.php @@ -140,6 +140,13 @@ class EditorController extends Controller { */ private $groupManager; + /** + * Avatar manager + * + * @var IAvatarManager + */ + private $avatarManager; + /** * @param string $AppName - application name * @param IRequest $request - request object @@ -186,6 +193,7 @@ public function __construct( $this->versionManager = new VersionManager($AppName, $root); $this->fileUtility = new FileUtility($AppName, $trans, $logger, $config, $shareManager, $session); + $this->avatarManager = \OC::$server->getAvatarManager(); } /** @@ -415,6 +423,49 @@ public function users($fileId, $operationType = null) { return $result; } + /** + * Get user for Info + * + * @param string $userIds - users identifiers + * + * @return array + * + * @NoAdminRequired + * @NoCSRFRequired + */ + public function userInfo($userIds) { + $result = []; + $userIds = json_decode($userIds, true); + + if ($userIds !== null && is_array($userIds)) { + foreach ($userIds as $userId) { + $userData = []; + $user = $this->userManager->get($this->getUserId($userId)); + if (!empty($user)) { + $userData = [ + "name" => $user->getDisplayName(), + "id" => $userId + ]; + $avatar = $this->avatarManager->getAvatar($user->getUID()); + if ($avatar->exists()) { + $userAvatarUrl = $this->urlGenerator->getAbsoluteURL( + $this->urlGenerator->linkToRoute( + "core.avatar.getAvatar", + [ + "userId" => $user->getUID(), + "size" => 64, + ] + ) + ); + $userData["image"] = $userAvatarUrl; + } + array_push($result, $userData); + } + } + } + return $result; + } + /** * Send notify about mention * @@ -761,6 +812,18 @@ public function save($name, $dir, $url) { return ["error" => $this->trans->t("You don't have enough permission to create")]; } + $documentServerUrl = $this->config->getDocumentServerUrl(); + + if (empty($documentServerUrl)) { + $this->logger->error("documentServerUrl is empty", ["app" => $this->appName]); + return ["error" => $this->trans->t("ONLYOFFICE app is not configured. Please contact admin")]; + } + + if (parse_url($url, PHP_URL_HOST) !== parse_url($documentServerUrl, PHP_URL_HOST)) { + $this->logger->error("Incorrect domain in file url", ["app" => $this->appName]); + return ["error" => $this->trans->t("The domain in the file url does not match the domain of the Document server")]; + } + $url = $this->config->replaceDocumentServerUrlToInternal($url); try { @@ -1092,7 +1155,16 @@ public function url($filePath) { $this->logger->error("File for generate presigned url was not found: $dir", ["app" => $this->appName]); return ["error" => $this->trans->t("File not found")]; } - if (!$file->isReadable()) { + + $canDownload = true; + + $fileStorage = $file->getStorage(); + if ($fileStorage->instanceOfStorage("\OCA\Files_Sharing\SharedStorage")) { + $share = $fileStorage->getShare(); + $canDownload = FileUtility::canShareDownload($share); + } + + if (!$file->isReadable() || !$canDownload) { $this->logger->error("File without permission: $dir", ["app" => $this->appName]); return ["error" => $this->trans->t("You do not have enough permissions to view the file")]; } @@ -1162,6 +1234,14 @@ public function download($fileId, $toExtension = null, $template = false) { return $this->renderError($this->trans->t("Not permitted")); } + $fileStorage = $file->getStorage(); + if ($fileStorage->instanceOfStorage("\OCA\Files_Sharing\SharedStorage")) { + $share = empty($share) ? $fileStorage->getShare() : $share; + if (!FileUtility::canShareDownload($share)) { + return $this->renderError($this->trans->t("Not permitted")); + } + } + $fileName = $file->getName(); $ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION)); $toExtension = strtolower($toExtension); @@ -1460,6 +1540,21 @@ private function limitEnumerationToGroups() { return false; } + /** + * Get Nextcloud userId from unique user identifier + * + * @param string $userId - current user identifier + * + * @return string + */ + private function getUserId($userId) { + if (str_contains($userId, "_")) { + $userIdExp = explode("_", $userId); + $userId = end($userIdExp); + } + return $userId; + } + /** * Print error page * diff --git a/js/editor.js b/js/editor.js index 9e2c44bb..093c3627 100644 --- a/js/editor.js +++ b/js/editor.js @@ -273,6 +273,7 @@ } OCA.Onlyoffice.resize(); + OCA.Onlyoffice.setViewport(); }; OCA.Onlyoffice.onRequestSaveAs = function (event) { @@ -517,16 +518,31 @@ OCA.Onlyoffice.onRequestUsers = function (event) { let operationType = typeof(event.data.c) !== "undefined" ? event.data.c : null; - $.get(OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/users?fileId={fileId}&operationType=" + operationType, - { - fileId: OCA.Onlyoffice.fileId || 0 - }), - function onSuccess(response) { - OCA.Onlyoffice.docEditor.setUsers({ - "c": operationType, - "users": response - }); - }); + switch (operationType) { + case "info": + $.get(OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/userInfo?userIds={userIds}", + { + userIds: JSON.stringify(event.data.id) + }), + function onSuccess(response) { + OCA.Onlyoffice.docEditor.setUsers({ + "c": operationType, + "users": response + }); + }); + break; + default: + $.get(OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/users?fileId={fileId}&operationType=" + operationType, + { + fileId: OCA.Onlyoffice.fileId || 0 + }), + function onSuccess(response) { + OCA.Onlyoffice.docEditor.setUsers({ + "c": operationType, + "users": response + }); + }); + } }; OCA.Onlyoffice.onRequestReferenceData = function (event) { @@ -692,6 +708,10 @@ } }; + OCA.Onlyoffice.setViewport = function() { + document.querySelector('meta[name="viewport"]').setAttribute("content","width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"); + }; + $(document).ready(OCA.Onlyoffice.InitEditor); })(jQuery, OCA); diff --git a/js/listener.js b/js/listener.js index e7d41af5..12df57f6 100644 --- a/js/listener.js +++ b/js/listener.js @@ -88,12 +88,18 @@ } else { OCA.Onlyoffice.unbindVersionClick(); } + + OCA.Onlyoffice.setViewport(); }; OCA.Onlyoffice.changeFavicon = function (favicon) { $('link[rel="icon"]').attr("href", favicon); }; + OCA.Onlyoffice.setViewport = function() { + document.querySelector('meta[name="viewport"]').setAttribute("content","width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"); + }; + OCA.Onlyoffice.onShowMessage = function (messageObj) { OC.Notification.show(messageObj.message, messageObj.props); } diff --git a/js/share.js b/js/share.js index a1364f54..7ae75725 100644 --- a/js/share.js +++ b/js/share.js @@ -341,7 +341,7 @@ } else if (attribute.key === "comment") { label = t(OCA.Onlyoffice.AppName, "comment"); } else if (attribute.key === "modifyFilter") { - label = t(OCA.Onlyoffice.AppName, "custom filter"); + label = t(OCA.Onlyoffice.AppName, "global filter"); } else { continue; } @@ -603,7 +603,7 @@ "scope": OCA.Onlyoffice.AppName, "key": "modifyFilter", "default": true, - "label": t(OCA.Onlyoffice.AppName, "custom filter"), + "label": t(OCA.Onlyoffice.AppName, "global filter"), "requiredPermissions": [OC.PERMISSION_UPDATE], "incompatibleAttributes": [ { diff --git a/l10n/bg_BG.js b/l10n/bg_BG.js index 240a5b3c..4362a217 100644 --- a/l10n/bg_BG.js +++ b/l10n/bg_BG.js @@ -45,11 +45,10 @@ OC.L10N.register( "View details" : "Виж детайли", "Save" : "Запази", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Смесеното активно съдържание е недопустимо. За ONLYOFFICE Docs е необходимо използването на HTTPS-адрес.", - "Restrict access to editors to following groups" : "Разреши достъп до редакторите само за тези групи", + "Allow the following groups to access the editors" : "Разреши достъп до редакторите само за тези групи", "review" : "преглед", "form filling" : "попълване на формуляр", "comment" : "коментар", - "custom filter" : "персонализиран филтър", "download" : "изтегли", "Server settings" : "Настройки на сървъра", "Common settings" : "Общи настройки", diff --git a/l10n/bg_BG.json b/l10n/bg_BG.json index e169214b..0ff9686e 100644 --- a/l10n/bg_BG.json +++ b/l10n/bg_BG.json @@ -43,11 +43,10 @@ "View details" : "Виж детайли", "Save" : "Запази", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Смесеното активно съдържание е недопустимо. За ONLYOFFICE Docs е необходимо използването на HTTPS-адрес.", - "Restrict access to editors to following groups" : "Разреши достъп до редакторите само за тези групи", + "Allow the following groups to access the editors" : "Разреши достъп до редакторите само за тези групи", "review" : "преглед", "form filling" : "попълване на формуляр", "comment" : "коментар", - "custom filter" : "персонализиран филтър", "download" : "изтегли", "Server settings" : "Настройки на сървъра", "Common settings" : "Общи настройки", diff --git a/l10n/ca.js b/l10n/ca.js index d8c2649e..872e27bd 100644 --- a/l10n/ca.js +++ b/l10n/ca.js @@ -45,11 +45,9 @@ OC.L10N.register( "View details" : "Veure detalls", "Save" : "Guardar", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Contingut Mixt Actiu no està permès. Es requereix la direcció HTTPS per a ONLYOFFICE Docs.", - "Restrict access to editors to following groups" : "Restringir l'accés a editors a següents grups", "review" : "", "form filling" : "", "comment" : "", - "custom filter" : "", "download" : "", "Server settings" : "Ajustos de servidor", "Common settings" : "Ajustos comuns", diff --git a/l10n/ca.json b/l10n/ca.json index 0d037d65..c468b51d 100644 --- a/l10n/ca.json +++ b/l10n/ca.json @@ -43,11 +43,9 @@ "View details" : "Veure detalls", "Save" : "Guardar", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Contingut Mixt Actiu no està permès. Es requereix la direcció HTTPS per a ONLYOFFICE Docs.", - "Restrict access to editors to following groups" : "Restringir l'accés a editors a següents grups", "review" : "", "form filling" : "", "comment" : "", - "custom filter" : "", "download" : "", "Server settings" : "Ajustos de servidor", "Common settings" : "Ajustos comuns", diff --git a/l10n/da.js b/l10n/da.js index f82aed55..e4ad0762 100644 --- a/l10n/da.js +++ b/l10n/da.js @@ -45,11 +45,9 @@ OC.L10N.register( "View details": "Se detaljer", "Save": "Gem", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required.": "Blandet aktivt indhold er ikke tilladt. HTTPS-adresse for ONLYOFFICE Docs er påkrævet.", - "Restrict access to editors to following groups": "Begræns adgangen til redaktører til følgende grupper", "review": "Anmeldelse", "form filling": "Formular udfyldning", "comment": "Kommentar", - "custom filter": "Brugerdefineret filter", "download": "Hent", "Server settings": "Serverindstillinger", "Common settings": "Fælles indstillinger", diff --git a/l10n/da.json b/l10n/da.json index f651f019..ac2024fc 100644 --- a/l10n/da.json +++ b/l10n/da.json @@ -43,11 +43,9 @@ "View details": "Se detaljer", "Save": "Gem", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required.": "Blandet aktivt indhold er ikke tilladt. HTTPS-adresse for ONLYOFFICE Docs er påkrævet.", - "Restrict access to editors to following groups": "Begræns adgangen til redaktører til følgende grupper", "review": "Anmeldelse", "form filling": "Formular udfyldning", "comment": "Kommentar", - "custom filter": "Brugerdefineret filter", "download": "Hent", "Server settings": "Serverindstillinger", "Common settings": "Fælles indstillinger", diff --git a/l10n/de.js b/l10n/de.js index 284937b8..6fb3a59b 100644 --- a/l10n/de.js +++ b/l10n/de.js @@ -45,11 +45,10 @@ OC.L10N.register( "View details" : "Details anzeigen", "Save" : "Speichern", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Mixed Active Content ist nicht möglich. HTTPS-Adresse für ONLYOFFICE Docs ist erforderlich.", - "Restrict access to editors to following groups" : "Den Zugriff auf Editoren auf folgende Gruppen gewähren", + "Allow the following groups to access the editors" : "Den Zugriff auf Editoren auf folgende Gruppen gewähren", "review" : "review", "form filling" : "ausfüllen von formularen", "comment" : "kommentarе", - "custom filter" : "benutzerdefinierter filter", "download" : "herunterladen", "Server settings" : "Servereinstellungen", "Common settings" : "Allgemeine Einstellungen", diff --git a/l10n/de.json b/l10n/de.json index 17a3e527..4299db1c 100644 --- a/l10n/de.json +++ b/l10n/de.json @@ -43,11 +43,10 @@ "View details" : "Details anzeigen", "Save" : "Speichern", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Mixed Active Content ist nicht möglich. HTTPS-Adresse für ONLYOFFICE Docs ist erforderlich.", - "Restrict access to editors to following groups" : "Den Zugriff auf Editoren auf folgende Gruppen gewähren", + "Allow the following groups to access the editors" : "Den Zugriff auf Editoren auf folgende Gruppen gewähren", "review" : "review", "form filling" : "ausfüllen von formularen", "comment" : "kommentarе", - "custom filter" : "benutzerdefinierter filter", "download" : "herunterladen", "Server settings" : "Servereinstellungen", "Common settings" : "Allgemeine Einstellungen", diff --git a/l10n/de_DE.js b/l10n/de_DE.js index 647b3236..2854ec14 100644 --- a/l10n/de_DE.js +++ b/l10n/de_DE.js @@ -45,11 +45,10 @@ OC.L10N.register( "View details" : "Details anzeigen", "Save" : "Speichern", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Mixed Active Content ist nicht möglich. HTTPS-Adresse für ONLYOFFICE Docs ist erforderlich.", - "Restrict access to editors to following groups" : "Den Zugriff auf Editoren auf folgende Gruppen gewähren", + "Allow the following groups to access the editors" : "Den Zugriff auf Editoren auf folgende Gruppen gewähren", "review" : "review", "form filling" : "ausfüllen von formularen", "comment" : "kommentarе", - "custom filter" : "benutzerdefinierter filter", "download" : "herunterladen", "Server settings" : "Servereinstellungen", "Common settings" : "Allgemeine Einstellungen", diff --git a/l10n/de_DE.json b/l10n/de_DE.json index 0d5502c8..db670481 100644 --- a/l10n/de_DE.json +++ b/l10n/de_DE.json @@ -43,11 +43,10 @@ "View details" : "Details anzeigen", "Save" : "Speichern", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Mixed Active Content ist nicht möglich. HTTPS-Adresse für ONLYOFFICE Docs ist erforderlich.", - "Restrict access to editors to following groups" : "Den Zugriff auf Editoren auf folgende Gruppen gewähren", + "Allow the following groups to access the editors" : "Den Zugriff auf Editoren auf folgende Gruppen gewähren", "review" : "review", "form filling" : "ausfüllen von formularen", "comment" : "kommentarе", - "custom filter" : "benutzerdefinierter filter", "download" : "herunterladen", "Server settings" : "Servereinstellungen", "Common settings" : "Allgemeine Einstellungen", diff --git a/l10n/es.js b/l10n/es.js index 05e233d6..afd6555f 100644 --- a/l10n/es.js +++ b/l10n/es.js @@ -45,11 +45,9 @@ OC.L10N.register( "View details" : "Ver detalles", "Save" : "Guardar", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Contenido Mixto Activo no está permitido. Se requiere la dirección HTTPS para ONLYOFFICE Docs.", - "Restrict access to editors to following groups" : "Restringir el acceso a editores a siguientes grupos", "review" : "revista", "form filling" : "relleno de formulario", "comment" : "comentarios", - "custom filter" : "filtro personalizado", "download" : "descargar", "Server settings" : "Ajustes de servidor", "Common settings" : "Ajustes comunes", diff --git a/l10n/es.json b/l10n/es.json index 3508ec87..2924e886 100644 --- a/l10n/es.json +++ b/l10n/es.json @@ -43,11 +43,9 @@ "View details" : "Ver detalles", "Save" : "Guardar", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Contenido Mixto Activo no está permitido. Se requiere la dirección HTTPS para ONLYOFFICE Docs.", - "Restrict access to editors to following groups" : "Restringir el acceso a editores a siguientes grupos", "review" : "revista", "form filling" : "relleno de formulario", "comment" : "comentarios", - "custom filter" : "filtro personalizado", "download" : "descargar", "Server settings" : "Ajustes de servidor", "Common settings" : "Ajustes comunes", diff --git a/l10n/fr.js b/l10n/fr.js index fd532962..88c32fe1 100644 --- a/l10n/fr.js +++ b/l10n/fr.js @@ -45,11 +45,9 @@ OC.L10N.register( "View details" : "Voir les détails", "Save" : "Enregistrer", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Le contenu mixte actif n'est pas autorisé. Une adresse HTTPS pour le ONLYOFFICE Docs est requise", - "Restrict access to editors to following groups" : "Restreindre l'accès aux éditeurs pour les groupes suivants", "review" : "révision", "form filling" : "remplissage de formulaire", "comment" : "commentaire", - "custom filter" : "filtre personnalisé", "download" : "télécharger", "Server settings" : "Paramètres du serveur", "Common settings" : "Paramètres communs", diff --git a/l10n/fr.json b/l10n/fr.json index 637cc6e4..047c47f4 100644 --- a/l10n/fr.json +++ b/l10n/fr.json @@ -43,11 +43,9 @@ "View details" : "Voir les détails", "Save" : "Enregistrer", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Le contenu mixte actif n'est pas autorisé. Une adresse HTTPS pour le ONLYOFFICE Docs est requise", - "Restrict access to editors to following groups" : "Restreindre l'accès aux éditeurs pour les groupes suivants", "review" : "révision", "form filling" : "remplissage de formulaire", "comment" : "commentaire", - "custom filter" : "filtre personnalisé", "download" : "télécharger", "Server settings" : "Paramètres du serveur", "Common settings" : "Paramètres communs", diff --git a/l10n/it.js b/l10n/it.js index 0c748d66..d4965b3a 100644 --- a/l10n/it.js +++ b/l10n/it.js @@ -45,11 +45,9 @@ OC.L10N.register( "View details" : "Vedi dettagli", "Save" : "Salva", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Il contenuto attivo misto non è consentito. È richiesto l'indirizzo HTTPS per ONLYOFFICE Docs.", - "Restrict access to editors to following groups" : "Limita l'accesso degli editor ai seguenti gruppi", "review" : "Revisione", "form filling" : "Compilare un modulo", "comment" : "Commento", - "custom filter" : "Filtro personalizzato", "download" : "Scarica", "Server settings" : "Impostazioni del server", "Common settings" : "Impostazioni comuni", diff --git a/l10n/it.json b/l10n/it.json index 7d15e8b7..b9c27cc3 100644 --- a/l10n/it.json +++ b/l10n/it.json @@ -43,11 +43,9 @@ "View details" : "Vedi dettagli", "Save" : "Salva", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Il contenuto attivo misto non è consentito. È richiesto l'indirizzo HTTPS per ONLYOFFICE Docs.", - "Restrict access to editors to following groups" : "Limita l'accesso degli editor ai seguenti gruppi", "review" : "Revisione", "form filling" : "Compilare un modulo", "comment" : "Commento", - "custom filter" : "Filtro personalizzato", "download" : "Scarica", "Server settings" : "Impostazioni del server", "Common settings" : "Impostazioni comuni", diff --git a/l10n/ja.js b/l10n/ja.js index 5cd04bf3..4487242c 100644 --- a/l10n/ja.js +++ b/l10n/ja.js @@ -45,11 +45,9 @@ OC.L10N.register( "View details" : "詳細表示", "Save" : "保存", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "アクティブコンテンツの混在は許可されていません。ONLYOFFICE DocsにはHTTPSアドレスが必要です", - "Restrict access to editors to following groups": "エディターの利用を以下のグループに制限する", "review" : "レビュー", "form filling" : "フォーム入力", "comment" : "コメント", - "custom filter" : "ユーザー設定フィルター", "download" : "ダウンロード", "Server settings" : "サーバー設定", "Common settings" : "共通設定", diff --git a/l10n/ja.json b/l10n/ja.json index cd9ceb55..ce447ca1 100644 --- a/l10n/ja.json +++ b/l10n/ja.json @@ -43,11 +43,9 @@ "View details" : "詳細表示", "Save" : "保存", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "アクティブコンテンツの混在は許可されていません。ONLYOFFICE DocsにはHTTPSアドレスが必要です", - "Restrict access to editors to following groups" : "エディターの利用を以下のグループに制限する", "review" : "レビュー", "form filling" : "フォーム入力", "comment" : "コメント", - "custom filter" : "ユーザー設定フィルター", "download" : "ダウンロード", "Server settings" : "サーバー設定", "Common settings" : "共通設定", diff --git a/l10n/nl.js b/l10n/nl.js index c77193e9..da588b57 100644 --- a/l10n/nl.js +++ b/l10n/nl.js @@ -45,11 +45,9 @@ OC.L10N.register( "View details": "Bekijk details", "Save": "Opslaan", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required.": "Gemende Actieve Inhoud is niet toegestaan. HTTPS-adres voor ONLYOFFICE Docs is vereist.", - "Restrict access to editors to following groups": "Beperk de toegang tot editors tot de volgende groepen", "review": "overzicht", "form filling": "formulier invullen", "comment": "opmerking", - "custom filter": "aangepast filter", "download": "downloaden", "Server settings": "Serverinstellingen", "Common settings": "Algemene instellingen", diff --git a/l10n/nl.json b/l10n/nl.json index 572f5fa7..fb5d79cd 100644 --- a/l10n/nl.json +++ b/l10n/nl.json @@ -43,11 +43,9 @@ "View details" : "Bekijk details", "Save" : "Opslaan", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Gemende Actieve Inhoud is niet toegestaan. HTTPS-adres voor ONLYOFFICE Docs is vereist.", - "Restrict access to editors to following groups" : "Beperk de toegang tot editors tot de volgende groepen", "review" : "overzicht", "form filling" : "formulier invullen", "comment" : "opmerking", - "custom filter" : "aangepast filter", "download" : "downloaden", "Server settings" : "Serverinstellingen", "Common settings" : "Algemene instellingen", diff --git a/l10n/pl.js b/l10n/pl.js index 3d97e2f5..32fbfc1f 100644 --- a/l10n/pl.js +++ b/l10n/pl.js @@ -45,11 +45,9 @@ OC.L10N.register( "View details" : "Szczegóły", "Save" : "Zapisz", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Aktywna Zawartość Mieszana nie jest dozwolona. Adres HTTPS jest wymagany dla ONLYOFFICE Docs.", - "Restrict access to editors to following groups" : "Ogranicz dostęp do edytorów dla tych grup", "review" : "recenzja", "form filling" : "wypełnianie formularza", "comment" : "komentarz", - "custom filter" : "niestandardowy filtr", "download" : "pobierz", "Server settings" : "Ustawienia serwera", "Common settings" : "Ustawienia ogólne", diff --git a/l10n/pl.json b/l10n/pl.json index 387688bd..8a1e94a9 100644 --- a/l10n/pl.json +++ b/l10n/pl.json @@ -43,11 +43,9 @@ "View details" : "Szczegóły", "Save" : "Zapisz", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Aktywna Zawartość Mieszana nie jest dozwolona. Adres HTTPS jest wymagany dla ONLYOFFICE Docs.", - "Restrict access to editors to following groups" : "Ogranicz dostęp do edytorów dla tych grup", "review" : "recenzja", "form filling" : "wypełnianie formularza", "comment" : "komentarz", - "custom filter" : "niestandardowy filtr", "download" : "pobierz", "Server settings" : "Ustawienia serwera", "Common settings" : "Ustawienia ogólne", diff --git a/l10n/pt_BR.js b/l10n/pt_BR.js index 9d041625..4166e670 100644 --- a/l10n/pt_BR.js +++ b/l10n/pt_BR.js @@ -45,11 +45,10 @@ OC.L10N.register( "View details" : "Ver detalhes", "Save" : "Salvar", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Conteúdo Misto não é permitido. É necessário um endereço HTTPS para o ONLYOFFICE Docs.", - "Restrict access to editors to following groups" : "Acesso apenas para os seguintes grupos", + "Allow the following groups to access the editors" : "Acesso apenas para os seguintes grupos", "review" : "revisar", "form filling" : "preenchimento de formularios", "comment" : "comente", - "custom filter" : "filtro personalizado", "download" : "baixar", "Server settings" : "Configurações do servidor", "Common settings" : "Configurações comuns", diff --git a/l10n/pt_BR.json b/l10n/pt_BR.json index 5d084772..f809232d 100644 --- a/l10n/pt_BR.json +++ b/l10n/pt_BR.json @@ -43,11 +43,10 @@ "View details" : "Ver detalhes", "Save" : "Salvar", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Conteúdo Misto não é permitido. É necessário um endereço HTTPS para o ONLYOFFICE Docs.", - "Restrict access to editors to following groups" : "Acesso apenas para os seguintes grupos", + "Allow the following groups to access the editors" : "Acesso apenas para os seguintes grupos", "review" : "revisar", "form filling" : "preenchimento de formularios", "comment" : "comente", - "custom filter" : "filtro personalizado", "download" : "baixar", "Server settings" : "Configurações do servidor", "Common settings" : "Configurações comuns", diff --git a/l10n/ru.js b/l10n/ru.js index 104bf03a..9ed026a7 100644 --- a/l10n/ru.js +++ b/l10n/ru.js @@ -45,11 +45,11 @@ OC.L10N.register( "View details" : "Подробнее", "Save" : "Сохранить", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Смешанное активное содержимое запрещено. Для ONLYOFFICE Docs необходимо использовать HTTPS-адрес.", - "Restrict access to editors to following groups" : "Дать доступ к редакторам только следующим группам", + "Allow the following groups to access the editors" : "Дать доступ к редакторам только следующим группам", "review" : "рецензирование", "form filling" : "заполнение форм", "comment" : "комментирование", - "custom filter" : "пользовательский фильтр", + "global filter" : "глобальный фильтр", "download" : "скачивание", "Server settings" : "Настройки сервера", "Common settings" : "Общие настройки", @@ -126,6 +126,7 @@ OC.L10N.register( "Select file to combine" : "Выбрать файл для объединения", "Select data source": "Выбрать источник данных", "The data source must not be the current document": "Источником данных не должен быть текущий документ", - "Enable background connection check to the editors": "Включить фоновую проверку подключения к редакторам" + "Enable background connection check to the editors": "Включить фоновую проверку подключения к редакторам", + "The domain in the file url does not match the domain of the Document server": "Домен в адресе файла не соответствует домену сервера документов" }, "nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);"); diff --git a/l10n/ru.json b/l10n/ru.json index 3dcca661..dbbbe8d2 100644 --- a/l10n/ru.json +++ b/l10n/ru.json @@ -43,11 +43,11 @@ "View details" : "Подробнее", "Save" : "Сохранить", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Смешанное активное содержимое запрещено. Для ONLYOFFICE Docs необходимо использовать HTTPS-адрес.", - "Restrict access to editors to following groups" : "Дать доступ к редакторам только следующим группам", + "Allow the following groups to access the editors" : "Дать доступ к редакторам только следующим группам", "review" : "рецензирование", "form filling" : "заполнение форм", "comment" : "комментирование", - "custom filter" : "пользовательский фильтр", + "global filter" : "глобальный фильтр", "download" : "скачивание", "Server settings" : "Настройки сервера", "Common settings" : "Общие настройки", @@ -124,6 +124,7 @@ "Select file to combine" : "Выбрать файл для объединения", "Select data source": "Выбрать источник данных", "The data source must not be the current document": "Источником данных не должен быть текущий документ", - "Enable background connection check to the editors": "Включить фоновую проверку подключения к редакторам" + "Enable background connection check to the editors": "Включить фоновую проверку подключения к редакторам", + "The domain in the file url does not match the domain of the Document server": "Домен в адресе файла не соответствует домену сервера документов" },"pluralForm" :"nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);" } \ No newline at end of file diff --git a/l10n/sv.js b/l10n/sv.js index 736e8142..d17263a8 100644 --- a/l10n/sv.js +++ b/l10n/sv.js @@ -45,11 +45,9 @@ OC.L10N.register( "View details" : "Visa detaljer", "Save" : "Spara", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Blandat aktivt innehåll är inte tillåtet. HTTPS-adress till ONLYOFFICE Docs krävs.", - "Restrict access to editors to following groups" : "Begränsa åtkomst till följande grupper", "review" : "granska", "form filling" : "formulärfyllning", "comment" : "kommentar", - "custom filter" : "anpassat filter", "download" : "ladda ner", "Server settings" : "Serverinställningar", "Common settings" : "Allmänna inställningar", diff --git a/l10n/sv.json b/l10n/sv.json index 69956b00..ad37882a 100644 --- a/l10n/sv.json +++ b/l10n/sv.json @@ -43,11 +43,9 @@ "View details" : "Visa detaljer", "Save" : "Spara", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "Blandat aktivt innehåll är inte tillåtet. HTTPS-adress till ONLYOFFICE Docs krävs.", - "Restrict access to editors to following groups" : "Begränsa åtkomst till följande grupper", "review" : "granska", "form filling" : "formulärfyllning", "comment" : "kommentar", - "custom filter" : "anpassat filter", "download" : "ladda ner", "Server settings" : "Serverinställningar", "Common settings" : "Allmänna inställningar", diff --git a/l10n/uk.js b/l10n/uk.js index e1fdfb0a..9d21c690 100644 --- a/l10n/uk.js +++ b/l10n/uk.js @@ -44,11 +44,10 @@ OC.L10N.register( "View details": "Докладно", "Save": "Зберегти", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required.": "Зміщаний активний вміст заборонено. Для використання ONLYOFFICE Docs потрібно використовувати безпечне HTTPS-з'єднання.", - "Restrict access to editors to following groups": "Надати доступ до редагування лише таким групам", + "Allow the following groups to access the editors": "Надати доступ до редагування лише таким групам", "review": "рецензії", "form filling": "заповнення форм", "comment": "коментарі", - "custom filter": "користувацький фільтр", "download": "звантажити", "Server settings": "Налаштування сервера", "Common settings": "Загальні налаштування", diff --git a/l10n/uk.json b/l10n/uk.json index de91615b..48f76a20 100644 --- a/l10n/uk.json +++ b/l10n/uk.json @@ -43,11 +43,10 @@ "View details": "Докладно", "Save": "Зберегти", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required.": "Зміщаний активний вміст заборонено. Для використання ONLYOFFICE Docs потрібно використовувати безпечне HTTPS-з'єднання.", - "Restrict access to editors to following groups": "Надати доступ до редагування лише таким групам", + "Allow the following groups to access the editors": "Надати доступ до редагування лише таким групам", "review": "рецензії", "form filling": "заповнення форм", "comment": "коментарі", - "custom filter": "користувацький фільтр", "download": "звантажити", "Server settings": "Налаштування сервера", "Common settings": "Загальні налаштування", diff --git a/l10n/zh_CN.js b/l10n/zh_CN.js index b356622a..e8d3ac90 100644 --- a/l10n/zh_CN.js +++ b/l10n/zh_CN.js @@ -45,11 +45,10 @@ OC.L10N.register( "View details" : "查看详情", "Save" : "保存", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "不允许混合活动内容,请使用HTTPS连接ONLYOFFICE Docs。", - "Restrict access to editors to following groups" : "仅授权的用户组可以使用该服务", + "Allow the following groups to access the editors" : "仅授权的用户组可以使用该服务", "review" : "审阅", "form filling" : "表单填报", "comment" : "评论", - "custom filter" : "自定义筛选器", "download" : "下载", "Server settings" : "服务器设置", "Common settings" : "常用设置", diff --git a/l10n/zh_CN.json b/l10n/zh_CN.json index 3981b395..4e411b7e 100644 --- a/l10n/zh_CN.json +++ b/l10n/zh_CN.json @@ -43,11 +43,10 @@ "View details" : "查看详情", "Save" : "保存", "Mixed Active Content is not allowed. HTTPS address for ONLYOFFICE Docs is required." : "不允许混合活动内容,请使用HTTPS连接ONLYOFFICE Docs。", - "Restrict access to editors to following groups" : "仅授权的用户组可以使用该服务", + "Allow the following groups to access the editors" : "仅授权的用户组可以使用该服务", "review" : "审阅", "form filling" : "表单填报", "comment" : "评论", - "custom filter" : "自定义筛选器", "download" : "下载", "Server settings" : "服务器设置", "Common settings" : "常用设置", diff --git a/lib/appconfig.php b/lib/appconfig.php index 4928a17f..f2cc4691 100644 --- a/lib/appconfig.php +++ b/lib/appconfig.php @@ -1070,7 +1070,7 @@ public function isUserAllowedToUse($userId = null) { $groups = $this->getLimitGroups(); // no group set -> all users are allowed - if (\count($groups) === 0) { + if (empty($groups)) { return true; } diff --git a/lib/fileutility.php b/lib/fileutility.php index 8f2b6dab..2d0782db 100644 --- a/lib/fileutility.php +++ b/lib/fileutility.php @@ -27,6 +27,7 @@ use OCP\ILogger; use OCP\ISession; use OCP\Share\IManager; +use OCP\Share\IShare; use OCA\Onlyoffice\AppConfig; use OCA\Onlyoffice\Version; @@ -297,4 +298,41 @@ public function getVersionKey($version) { return $key; } + + /** + * The method checks download permission + * + * @param IShare $share - share object + * + * @return bool + */ + public static function canShareDownload($share) { + $can = true; + + $downloadAttribute = self::getShareAttrubute($share, "download"); + if (isset($downloadAttribute)) { + $can = $downloadAttribute; + } + + return $can; + } + + /** + * The method extracts share attribute + * + * @param IShare $share - share object + * @param string $attribute - attribute name + * + * @return bool|null + */ + private static function getShareAttrubute($share, $attribute) { + $attributes = null; + if (method_exists(IShare::class, "getAttributes")) { + $attributes = $share->getAttributes(); + } + + $attribute = isset($attributes) ? $attributes->getAttribute("permissions", $attribute) : null; + + return $attribute; + } } diff --git a/lib/hookhandler.php b/lib/hookhandler.php index b1ca06e5..36c6b465 100644 --- a/lib/hookhandler.php +++ b/lib/hookhandler.php @@ -40,7 +40,7 @@ public static function publicPage() { $appConfig = new AppConfig($appName); - if (!empty($appConfig->getDocumentServerUrl()) && $appConfig->settingsAreSuccessful()) { + if (!empty($appConfig->getDocumentServerUrl()) && $appConfig->settingsAreSuccessful() && empty($appConfig->getLimitGroups())) { Util::addScript("onlyoffice", "main"); Util::addScript("onlyoffice", "share"); diff --git a/templates/settings.php b/templates/settings.php index ebd4c575..46d46d21 100644 --- a/templates/settings.php +++ b/templates/settings.php @@ -112,7 +112,7 @@

0) { ?>checked="checked" /> - +
" style="display: block; margin-top: 6px; width: 265px;" />