Merge pull request #26624 from nextcloud/enh/sharing/readperm

Consider read permission in sharing tab
This commit is contained in:
Morris Jobke 2021-04-20 09:27:45 +02:00 committed by GitHub
commit 67ab4dd6c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 5 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -326,6 +326,16 @@ export default {
}, },
}, },
/**
* Is this share readable
* Needed for some federated shares that might have been added from file drop links
*/
hasRead: {
get() {
return this.share.hasReadPermission
},
},
/** /**
* Is the current share a folder ? * Is the current share a folder ?
* @returns {boolean} * @returns {boolean}
@ -377,7 +387,8 @@ export default {
methods: { methods: {
updatePermissions({ isEditChecked = this.canEdit, isCreateChecked = this.canCreate, isDeleteChecked = this.canDelete, isReshareChecked = this.canReshare } = {}) { 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 = 0
| (this.hasRead ? this.permissionsRead : 0)
| (isCreateChecked ? this.permissionsCreate : 0) | (isCreateChecked ? this.permissionsCreate : 0)
| (isDeleteChecked ? this.permissionsDelete : 0) | (isDeleteChecked ? this.permissionsDelete : 0)
| (isEditChecked ? this.permissionsEdit : 0) | (isEditChecked ? this.permissionsEdit : 0)

View File

@ -450,6 +450,18 @@ export default class Share {
} }
// PERMISSIONS Shortcuts // PERMISSIONS Shortcuts
/**
* Does this share have READ permissions
*
* @returns {boolean}
* @readonly
* @memberof Share
*/
get hasReadPermission() {
return !!((this.permissions & OC.PERMISSION_READ))
}
/** /**
* Does this share have CREATE permissions * Does this share have CREATE permissions
* *