aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/src/components/SharingEntry.vue
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/src/components/SharingEntry.vue')
-rw-r--r--apps/files_sharing/src/components/SharingEntry.vue42
1 files changed, 41 insertions, 1 deletions
diff --git a/apps/files_sharing/src/components/SharingEntry.vue b/apps/files_sharing/src/components/SharingEntry.vue
index 25baf536f2f..e4754b86f4f 100644
--- a/apps/files_sharing/src/components/SharingEntry.vue
+++ b/apps/files_sharing/src/components/SharingEntry.vue
@@ -78,6 +78,12 @@
{{ t('files_sharing', 'Allow resharing') }}
</ActionCheckbox>
+ <ActionCheckbox ref="canDownload"
+ :checked.sync="canDownload"
+ :disabled="saving || !canSetDownload">
+ {{ t('files_sharing', 'Allow download') }}
+ </ActionCheckbox>
+
<!-- expiration date -->
<ActionCheckbox :checked.sync="hasExpirationDate"
:disabled="config.isDefaultInternalExpireDateEnforced || saving"
@@ -272,6 +278,18 @@ export default {
},
/**
+ * Can the sharer set whether the sharee can download the file ?
+ *
+ * @return {boolean}
+ */
+ canSetDownload() {
+ // If the owner revoked the permission after the resharer granted it
+ // the share still has the permission, and the resharer is still
+ // allowed to revoke it too (but not to grant it again).
+ return (this.fileInfo.canDownload() || this.canDownload)
+ },
+
+ /**
* Can the sharee edit the shared file ?
*/
canEdit: {
@@ -320,6 +338,18 @@ export default {
},
/**
+ * Can the sharee download files or only view them ?
+ */
+ canDownload: {
+ get() {
+ return this.share.hasDownloadPermission
+ },
+ set(checked) {
+ this.updatePermissions({ isDownloadChecked: checked })
+ },
+ },
+
+ /**
* Is this share readable
* Needed for some federated shares that might have been added from file drop links
*/
@@ -380,7 +410,13 @@ export default {
},
methods: {
- updatePermissions({ isEditChecked = this.canEdit, isCreateChecked = this.canCreate, isDeleteChecked = this.canDelete, isReshareChecked = this.canReshare } = {}) {
+ updatePermissions({
+ isEditChecked = this.canEdit,
+ isCreateChecked = this.canCreate,
+ isDeleteChecked = this.canDelete,
+ isReshareChecked = this.canReshare,
+ isDownloadChecked = this.canDownload,
+ } = {}) {
// calc permissions if checked
const permissions = 0
| (this.hasRead ? this.permissionsRead : 0)
@@ -390,6 +426,10 @@ export default {
| (isReshareChecked ? this.permissionsShare : 0)
this.share.permissions = permissions
+ if (this.share.hasDownloadPermission !== isDownloadChecked) {
+ this.share.hasDownloadPermission = isDownloadChecked
+ this.queueUpdate('attributes')
+ }
this.queueUpdate('permissions')
},