]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(SharingDetailsView): Prevent illegal unselection of read permissions
authorfenn-cs <fenn25.fn@gmail.com>
Fri, 5 Jul 2024 14:47:41 +0000 (15:47 +0100)
committerfenn-cs <fenn25.fn@gmail.com>
Mon, 8 Jul 2024 19:32:52 +0000 (20:32 +0100)
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>
apps/files_sharing/src/views/SharingDetailsTab.vue

index 8254e84b4a3f20bad65fcf54dafd91a0889cbdcc..7f8ae7d17d853e03c6726b6123cb126d0020a1e6 100644 (file)
                                                {{ t('files_sharing', 'Custom permissions') }}
                                        </NcCheckboxRadioSwitch>
                                        <section v-if="setCustomPermissions" class="custom-permissions-group">
-                                               <NcCheckboxRadioSwitch :disabled="!allowsFileDrop && share.type === SHARE_TYPES.SHARE_TYPE_LINK"
+                                               <NcCheckboxRadioSwitch :disabled="!canRemoveReadPermission"
                                                        :checked.sync="hasRead"
                                                        data-cy-files-sharing-share-permissions-checkbox="read">
                                                        {{ t('files_sharing', 'Read') }}
@@ -602,6 +602,9 @@ export default {
                        // allowed to revoke it too (but not to grant it again).
                        return (this.fileInfo.canDownload() || this.canDownload)
                },
+               canRemoveReadPermission() {
+                       return this.allowsFileDrop && this.share.type === this.SHARE_TYPES.SHARE_TYPE_LINK
+               },
                // if newPassword exists, but is empty, it means
                // the user deleted the original password
                hasUnsavedPassword() {
@@ -822,6 +825,10 @@ export default {
                                        this.setCustomPermissions = true
                                }
                        }
+                       // Read permission required for share creation
+                       if (!this.canRemoveReadPermission) {
+                               this.hasRead = true
+                       }
                },
                handleCustomPermissions() {
                        if (!this.isNewShare && (this.hasCustomPermissions || this.share.setCustomPermissions)) {