Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/files_sharing/js/dist/files_sharing_tab.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/files_sharing/js/dist/files_sharing_tab.js.map

Large diffs are not rendered by default.

65 changes: 60 additions & 5 deletions apps/files_sharing/src/components/SharingEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,33 @@
{{ t('files_sharing', 'Allow editing') }}
</ActionCheckbox>

<!-- create permission -->
<ActionCheckbox
v-if="isFolder"
ref="canCreate"
:checked.sync="canCreate"
:value="permissionsCreate"
:disabled="saving">
{{ t('files_sharing', 'Allow creating') }}
</ActionCheckbox>

<!-- delete permission -->
<ActionCheckbox
v-if="isFolder"
ref="canDelete"
:checked.sync="canDelete"
:value="permissionsDelete"
:disabled="saving">
{{ t('files_sharing', 'Allow deleting') }}
</ActionCheckbox>

<!-- reshare permission -->
<ActionCheckbox
ref="canReshare"
:checked.sync="canReshare"
:value="permissionsShare"
:disabled="saving">
{{ t('files_sharing', 'Can reshare') }}
{{ t('files_sharing', 'Allow resharing') }}
</ActionCheckbox>

<!-- expiration date -->
Expand Down Expand Up @@ -142,6 +162,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,
}
Expand Down Expand Up @@ -197,7 +219,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 })
},
},

Expand All @@ -209,10 +255,18 @@ export default {
return this.share.hasSharePermission
},
set: function(checked) {
this.updatePermissions(this.canEdit, checked)
this.updatePermissions({ isReshareChecked: checked })
},
},

/**
* Is the current share a folder ?
* @returns {boolean}
*/
isFolder() {
return this.fileInfo.type === 'dir'
},

/**
* Does the current share have an expiration date
* @returns {boolean}
Expand All @@ -238,17 +292,18 @@ 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)

this.share.permissions = permissions
this.queueUpdate('permissions')
},
},

}
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,18 @@ public static function canReshareCheckbox($sharedWithName) {
// forThe()->checkbox("Can reshare") can not be used here; that would
// return the checkbox itself, but the element that the user interacts
// with is the label.
return Locator::forThe()->xpath("//label[normalize-space() = 'Can reshare']")->
return Locator::forThe()->xpath("//label[normalize-space() = 'Allow resharing']")->
descendantOf(self::shareWithMenu($sharedWithName))->
describedAs("Can reshare checkbox in the share with $sharedWithName menu in the details view in Files app");
describedAs("Allow resharing checkbox in the share with $sharedWithName menu in the details view in Files app");
}

/**
* @return Locator
*/
public static function canReshareCheckboxInput($sharedWithName) {
return Locator::forThe()->checkbox("Can reshare")->
return Locator::forThe()->checkbox("Allow resharing")->
descendantOf(self::shareWithMenu($sharedWithName))->
describedAs("Can reshare checkbox input in the share with $sharedWithName menu in the details view in Files app");
describedAs("Allow resharing checkbox input in the share with $sharedWithName menu in the details view in Files app");
}

/**
Expand Down