mirror of
https://github.com/nextcloud/server.git
synced 2026-02-11 23:04:22 -05:00
Remove copy in file actions when not allowed
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
This commit is contained in:
parent
15416e7305
commit
5fb827d062
5 changed files with 27 additions and 5 deletions
|
|
@ -670,6 +670,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');
|
||||
|
|
@ -682,7 +685,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') {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
4
dist/files_sharing-additionalScripts.js
vendored
4
dist/files_sharing-additionalScripts.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files_sharing-additionalScripts.js.map
vendored
2
dist/files_sharing-additionalScripts.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue