]> source.dussan.org Git - nextcloud-server.git/commitdiff
add create and delete checkbox for sharesidebar
authorGreta Doci <gretadoci@gmail.com>
Tue, 19 Nov 2019 15:07:57 +0000 (16:07 +0100)
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Thu, 19 Dec 2019 15:12:11 +0000 (16:12 +0100)
Signed-off-by: Greta Doci <gretadoci@gmail.com>
apps/files_sharing/src/components/SharingEntry.vue

index 2174708975300683fa9b2aefa1f6a19be827278d..ad36361b9c2ead258a5eb9557bab8c5209fdb485 100644 (file)
                                        {{ t('files_sharing', 'Allow editing') }}
                                </ActionCheckbox>
 
+                               <!-- create permission -->
+                               <ActionCheckbox
+                                       ref="canCreate"
+                                       :checked.sync="canCreate"
+                                       :value="permissionsCreate"
+                                       :disabled="saving">
+                                       {{ t('files_sharing', 'Allow creating') }}
+                               </ActionCheckbox>
                                <!-- reshare permission -->
                                <ActionCheckbox
                                        ref="canReshare"
                                        :checked.sync="canReshare"
                                        :value="permissionsShare"
                                        :disabled="saving">
-                                       {{ t('files_sharing', 'Can reshare') }}
+                                       {{ t('files_sharing', 'Allow resharing') }}
                                </ActionCheckbox>
 
+                               <!-- delete permission -->
+                               <ActionCheckbox
+                                       ref="canDelete"
+                                       :checked.sync="canDelete"
+                                       :value="permissionsDelete"
+                                       :disabled="saving">
+                                       {{ t('files_sharing', 'Allow deleting') }}
+                               </ActionCheckbox>
                                <!-- expiration date -->
                                <ActionCheckbox :checked.sync="hasExpirationDate"
                                        :disabled="config.isDefaultExpireDateEnforced || saving"
@@ -142,6 +158,8 @@ export default {
        data() {
                return {
                        permissionsEdit: OC.PERMISSION_UPDATE,
+                       permissionsCreate: OC.PERMISSION_CREATE,
+                       permissionsDelete: OC.PERMISSION_DELETE,
                        permissionsRead: OC.PERMISSION_READ,
                        permissionsShare: OC.PERMISSION_SHARE,
                }
@@ -197,7 +215,31 @@ export default {
                                return this.share.hasUpdatePermission
                        },
                        set: function(checked) {
-                               this.updatePermissions(checked, this.canReshare)
+                               this.updatePermissions({ isEditChecked: checked })
+                       },
+               },
+
+               /**
+                * Can the sharee create the shared file ?
+                */
+               canCreate: {
+                       get: function() {
+                               return this.share.hasCreatePermission
+                       },
+                       set: function(checked) {
+                               this.updatePermissions({ isCreateChecked: checked })
+                       },
+               },
+
+               /**
+                * Can the sharee delete the shared file ?
+                */
+               canDelete: {
+                       get: function() {
+                               return this.share.hasDeletePermission
+                       },
+                       set: function(checked) {
+                               this.updatePermissions({ isDeleteChecked: checked })
                        },
                },
 
@@ -209,7 +251,7 @@ export default {
                                return this.share.hasSharePermission
                        },
                        set: function(checked) {
-                               this.updatePermissions(this.canEdit, checked)
+                               this.updatePermissions({ isReshareChecked: checked })
                        },
                },
 
@@ -238,9 +280,11 @@ export default {
        },
 
        methods: {
-               updatePermissions(isEditChecked, isReshareChecked) {
+               updatePermissions({ isEditChecked = this.canEdit, isCreateChecked = this.canCreate, isDeleteChecked = this.canDelete, isReshareChecked = this.canReshare } = {}) {
                        // calc permissions if checked
                        const permissions = this.permissionsRead
+                               | (isCreateChecked ? this.permissionsCreate : 0)
+                               | (isDeleteChecked ? this.permissionsDelete : 0)
                                | (isEditChecked ? this.permissionsEdit : 0)
                                | (isReshareChecked ? this.permissionsShare : 0)
 
@@ -248,7 +292,6 @@ export default {
                        this.queueUpdate('permissions')
                },
        },
-
 }
 </script>