diff options
Diffstat (limited to 'apps/files_sharing/src/components/SharingEntry.vue')
-rw-r--r-- | apps/files_sharing/src/components/SharingEntry.vue | 56 |
1 files changed, 52 insertions, 4 deletions
diff --git a/apps/files_sharing/src/components/SharingEntry.vue b/apps/files_sharing/src/components/SharingEntry.vue index 4af3a6b4431..70b95544b64 100644 --- a/apps/files_sharing/src/components/SharingEntry.vue +++ b/apps/files_sharing/src/components/SharingEntry.vue @@ -40,7 +40,7 @@ ref="canEdit" :checked.sync="canEdit" :value="permissionsEdit" - :disabled="saving"> + :disabled="saving || !canSetEdit"> {{ t('files_sharing', 'Allow editing') }} </ActionCheckbox> @@ -50,7 +50,7 @@ ref="canCreate" :checked.sync="canCreate" :value="permissionsCreate" - :disabled="saving"> + :disabled="saving || !canSetCreate"> {{ t('files_sharing', 'Allow creating') }} </ActionCheckbox> @@ -60,7 +60,7 @@ ref="canDelete" :checked.sync="canDelete" :value="permissionsDelete" - :disabled="saving"> + :disabled="saving || !canSetDelete"> {{ t('files_sharing', 'Allow deleting') }} </ActionCheckbox> @@ -69,7 +69,7 @@ ref="canReshare" :checked.sync="canReshare" :value="permissionsShare" - :disabled="saving"> + :disabled="saving || !canSetReshare"> {{ t('files_sharing', 'Allow resharing') }} </ActionCheckbox> @@ -217,6 +217,54 @@ export default { }, /** + * Can the sharer set whether the sharee can edit the file ? + * + * @returns {boolean} + */ + canSetEdit() { + // 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.sharePermissions & OC.PERMISSION_UPDATE) || this.canEdit + }, + + /** + * Can the sharer set whether the sharee can create the file ? + * + * @returns {boolean} + */ + canSetCreate() { + // 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.sharePermissions & OC.PERMISSION_CREATE) || this.canCreate + }, + + /** + * Can the sharer set whether the sharee can delete the file ? + * + * @returns {boolean} + */ + canSetDelete() { + // 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.sharePermissions & OC.PERMISSION_DELETE) || this.canDelete + }, + + /** + * Can the sharer set whether the sharee can reshare the file ? + * + * @returns {boolean} + */ + canSetReshare() { + // 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.sharePermissions & OC.PERMISSION_SHARE) || this.canReshare + }, + + /** * Can the sharee edit the shared file ? */ canEdit: { |