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

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2022-08-26 21:00:12 +0300
committerGitHub <noreply@github.com>2022-08-26 21:00:12 +0300
commit47584eee601594a066099b701e0ea61a5c8fec2a (patch)
tree472471347798c3a398698404b2ad1c59b20c7894 /apps
parentefbe9724076823a55485096a8ec88544410d791e (diff)
parentd1317e75409bdb2f37129ce07aee621bbe2b1a6c (diff)
Merge pull request #33713 from nextcloud/bugfix/noid/viewonlyfix
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/DAV/ViewOnlyPlugin.php1
-rw-r--r--apps/files/js/fileactions.js9
-rw-r--r--apps/files/js/fileinfomodel.js13
-rw-r--r--apps/files_sharing/src/share.js4
4 files changed, 25 insertions, 2 deletions
diff --git a/apps/dav/lib/DAV/ViewOnlyPlugin.php b/apps/dav/lib/DAV/ViewOnlyPlugin.php
index 1504969b5b4..b4652da09e1 100644
--- a/apps/dav/lib/DAV/ViewOnlyPlugin.php
+++ b/apps/dav/lib/DAV/ViewOnlyPlugin.php
@@ -57,6 +57,7 @@ class ViewOnlyPlugin extends ServerPlugin {
//priority 90 to make sure the plugin is called before
//Sabre\DAV\CorePlugin::httpGet
$this->server->on('method:GET', [$this, 'checkViewOnly'], 90);
+ $this->server->on('method:COPY', [$this, 'checkViewOnly'], 90);
}
/**
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index 9b86c6521ae..f342f21a4fb 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -673,6 +673,9 @@
displayName: function(context) {
var permissions = context.fileInfoModel.attributes.permissions;
if (permissions & OC.PERMISSION_UPDATE) {
+ if (!context.fileInfoModel.canDownload()) {
+ return t('files', 'Move');
+ }
return t('files', 'Move or copy');
}
return t('files', 'Copy');
@@ -685,7 +688,11 @@
var permissions = context.fileInfoModel.attributes.permissions;
var actions = OC.dialogs.FILEPICKER_TYPE_COPY;
if (permissions & OC.PERMISSION_UPDATE) {
- actions = OC.dialogs.FILEPICKER_TYPE_COPY_MOVE;
+ if (!context.fileInfoModel.canDownload()) {
+ actions = OC.dialogs.FILEPICKER_TYPE_MOVE;
+ } else {
+ actions = OC.dialogs.FILEPICKER_TYPE_COPY_MOVE;
+ }
}
var dialogDir = context.dir;
if (typeof context.fileList.dirInfo.dirLastCopiedTo !== 'undefined') {
diff --git a/apps/files/js/fileinfomodel.js b/apps/files/js/fileinfomodel.js
index 83a8c62592b..79575109656 100644
--- a/apps/files/js/fileinfomodel.js
+++ b/apps/files/js/fileinfomodel.js
@@ -126,7 +126,18 @@
});
return deferred.promise();
- }
+ },
+
+ canDownload: function() {
+ for (const i in this.attributes.shareAttributes) {
+ const attr = this.attributes.shareAttributes[i]
+ if (attr.scope === 'permissions' && attr.key === 'download') {
+ return attr.enabled
+ }
+ }
+
+ return true
+ },
});
if (!OCA.Files) {
diff --git a/apps/files_sharing/src/share.js b/apps/files_sharing/src/share.js
index 76c007b5218..93891cbf287 100644
--- a/apps/files_sharing/src/share.js
+++ b/apps/files_sharing/src/share.js
@@ -94,6 +94,10 @@ import { getCapabilities } from '@nextcloud/capabilities'
}
if (_.isFunction(fileData.canDownload) && !fileData.canDownload()) {
delete fileActions.actions.all.Download
+ if (fileData.permissions & OC.PERMISSION_UPDATE === 0) {
+ // neither move nor copy is allowed, remove the action completely
+ delete fileActions.actions.all.MoveCopy
+ }
}
tr.attr('data-share-permissions', sharePermissions)
tr.attr('data-share-attributes', JSON.stringify(fileData.shareAttributes))