Skip to content

Commit 656e109

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 a98a0eb commit 656e109

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
@@ -180,7 +180,7 @@
180180
{{ t('files_sharing', 'Custom permissions') }}
181181
</NcCheckboxRadioSwitch>
182182
<section v-if="setCustomPermissions" class="custom-permissions-group">
183-
<NcCheckboxRadioSwitch :disabled="!allowsFileDrop && share.type === SHARE_TYPES.SHARE_TYPE_LINK"
183+
<NcCheckboxRadioSwitch :disabled="!canRemoveReadPermission"
184184
:checked.sync="hasRead"
185185
data-cy-files-sharing-share-permissions-checkbox="read">
186186
{{ t('files_sharing', 'Read') }}
@@ -602,6 +602,9 @@ export default {
602602
// allowed to revoke it too (but not to grant it again).
603603
return (this.fileInfo.canDownload() || this.canDownload)
604604
},
605+
canRemoveReadPermission() {
606+
return this.allowsFileDrop && this.share.type === this.SHARE_TYPES.SHARE_TYPE_LINK
607+
},
605608
// if newPassword exists, but is empty, it means
606609
// the user deleted the original password
607610
hasUnsavedPassword() {
@@ -822,6 +825,10 @@ export default {
822825
this.setCustomPermissions = true
823826
}
824827
}
828+
// Read permission required for share creation
829+
if (!this.canRemoveReadPermission) {
830+
this.hasRead = true
831+
}
825832
},
826833
handleCustomPermissions() {
827834
if (!this.isNewShare && (this.hasCustomPermissions || this.share.setCustomPermissions)) {

0 commit comments

Comments
 (0)