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') }}
|
{{ t('files_sharing', 'Allow editing') }}
|
||||||
</ActionCheckbox>
|
</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 -->
|
<!-- reshare permission -->
|
||||||
<ActionCheckbox
|
<ActionCheckbox
|
||||||
ref="canReshare"
|
ref="canReshare"
|
||||||
:checked.sync="canReshare"
|
:checked.sync="canReshare"
|
||||||
:value="permissionsShare"
|
:value="permissionsShare"
|
||||||
:disabled="saving">
|
:disabled="saving">
|
||||||
{{ t('files_sharing', 'Can reshare') }}
|
{{ t('files_sharing', 'Allow resharing') }}
|
||||||
</ActionCheckbox>
|
</ActionCheckbox>
|
||||||
|
|
||||||
<!-- expiration date -->
|
<!-- expiration date -->
|
||||||
|
@ -142,6 +162,8 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
permissionsEdit: OC.PERMISSION_UPDATE,
|
permissionsEdit: OC.PERMISSION_UPDATE,
|
||||||
|
permissionsCreate: OC.PERMISSION_CREATE,
|
||||||
|
permissionsDelete: OC.PERMISSION_DELETE,
|
||||||
permissionsRead: OC.PERMISSION_READ,
|
permissionsRead: OC.PERMISSION_READ,
|
||||||
permissionsShare: OC.PERMISSION_SHARE,
|
permissionsShare: OC.PERMISSION_SHARE,
|
||||||
}
|
}
|
||||||
|
@ -197,7 +219,31 @@ export default {
|
||||||
return this.share.hasUpdatePermission
|
return this.share.hasUpdatePermission
|
||||||
},
|
},
|
||||||
set: function(checked) {
|
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
|
return this.share.hasSharePermission
|
||||||
},
|
},
|
||||||
set: function(checked) {
|
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
|
* Does the current share have an expiration date
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
|
@ -238,9 +292,11 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
updatePermissions(isEditChecked, isReshareChecked) {
|
updatePermissions({ isEditChecked = this.canEdit, isCreateChecked = this.canCreate, isDeleteChecked = this.canDelete, isReshareChecked = this.canReshare } = {}) {
|
||||||
// calc permissions if checked
|
// calc permissions if checked
|
||||||
const permissions = this.permissionsRead
|
const permissions = this.permissionsRead
|
||||||
|
| (isCreateChecked ? this.permissionsCreate : 0)
|
||||||
|
| (isDeleteChecked ? this.permissionsDelete : 0)
|
||||||
| (isEditChecked ? this.permissionsEdit : 0)
|
| (isEditChecked ? this.permissionsEdit : 0)
|
||||||
| (isReshareChecked ? this.permissionsShare : 0)
|
| (isReshareChecked ? this.permissionsShare : 0)
|
||||||
|
|
||||||
|
@ -248,7 +304,6 @@ export default {
|
||||||
this.queueUpdate('permissions')
|
this.queueUpdate('permissions')
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -108,18 +108,18 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
|
||||||
// forThe()->checkbox("Can reshare") can not be used here; that would
|
// forThe()->checkbox("Can reshare") can not be used here; that would
|
||||||
// return the checkbox itself, but the element that the user interacts
|
// return the checkbox itself, but the element that the user interacts
|
||||||
// with is the label.
|
// 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))->
|
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
|
* @return Locator
|
||||||
*/
|
*/
|
||||||
public static function canReshareCheckboxInput($sharedWithName) {
|
public static function canReshareCheckboxInput($sharedWithName) {
|
||||||
return Locator::forThe()->checkbox("Can reshare")->
|
return Locator::forThe()->checkbox("Allow resharing")->
|
||||||
descendantOf(self::shareWithMenu($sharedWithName))->
|
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