add create and delete checkbox for sharesidebar (#18010)
add create and delete checkbox for sharesidebar
This commit is contained in:
commit
176d8e8ab3
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -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 -->
|
||||
|
@ -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,
|
||||
}
|
||||
|
@ -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 })
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -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}
|
||||
|
@ -238,9 +292,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 +304,6 @@ export default {
|
|||
this.queueUpdate('permissions')
|
||||
},
|
||||
},
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -108,18 +108,18 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
|
|||
// 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");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue