Skip to content

Commit fbc8cfa

Browse files
committed
fix(SharingDetailsView): Prevent illegal unselection of read permissions
With the exception of "file drop" on link shares all other shares need the read permissions at least. Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
1 parent 90d712f commit fbc8cfa

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

apps/files_sharing/src/views/SharingDetailsTab.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
{{ t('files_sharing', 'Custom permissions') }}
151151
</NcCheckboxRadioSwitch>
152152
<section v-if="setCustomPermissions" class="custom-permissions-group">
153-
<NcCheckboxRadioSwitch :disabled="!allowsFileDrop && share.type === SHARE_TYPES.SHARE_TYPE_LINK"
153+
<NcCheckboxRadioSwitch :disabled="!canRemoveReadPermission"
154154
:checked.sync="hasRead">
155155
{{ t('files_sharing', 'Read') }}
156156
</NcCheckboxRadioSwitch>
@@ -534,6 +534,9 @@ export default {
534534
// allowed to revoke it too (but not to grant it again).
535535
return (this.fileInfo.canDownload() || this.canDownload)
536536
},
537+
canRemoveReadPermission() {
538+
return this.allowsFileDrop && this.share.type === this.SHARE_TYPES.SHARE_TYPE_LINK
539+
},
537540
// if newPassword exists, but is empty, it means
538541
// the user deleted the original password
539542
hasUnsavedPassword() {
@@ -736,6 +739,10 @@ export default {
736739
this.setCustomPermissions = true
737740
}
738741
}
742+
// Read permission required for share creation
743+
if (!this.canRemoveReadPermission) {
744+
this.hasRead = true
745+
}
739746
},
740747
handleCustomPermissions() {
741748
if (!this.isNewShare && (this.hasCustomPermissions || this.share.setCustomPermissions)) {

0 commit comments

Comments
 (0)