Skip to content

Commit

Permalink
Merge pull request #8623 from owncloud/fix-password-enforced-check
Browse files Browse the repository at this point in the history
fix: don't run into early return in password enforcement check
  • Loading branch information
kulmann authored Mar 15, 2023
2 parents b93a546 + 75482b2 commit ba644f6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-password-enforced-check
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: password enforced check for public links

We've fixed a bug where we ignored the selected role in the password enforcement check. The web ui was sending the request to update a link instead of showing a modal with a password input prompt.

https://github.com/owncloud/web/issues/8587
https://github.com/owncloud/web/pull/8623
23 changes: 10 additions & 13 deletions packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -348,19 +348,16 @@ export default defineComponent({
const canCreate = currentRole.hasPermission(SharePermissions.create)
const canDelete = currentRole.hasPermission(SharePermissions.delete)
if (this.passwordEnforced.read_only === true) {
return canRead && !canUpdate && !canCreate && !canDelete
}
if (this.passwordEnforced.upload_only === true) {
return !canRead && !canUpdate && canCreate && !canDelete
}
if (this.passwordEnforced.read_write === true) {
return canRead && !canUpdate && canCreate && !canDelete
}
if (this.passwordEnforced.read_write_delete === true) {
return canRead && canUpdate && canCreate && canDelete
}
return false
const isReadOnly = canRead && !canUpdate && !canCreate && !canDelete
const isUploadOnly = !canRead && !canUpdate && canCreate && !canDelete
const isReadWrite = canRead && !canUpdate && canCreate && !canDelete
const isReadWriteDelete = canRead && canUpdate && canCreate && canDelete
return (
(this.passwordEnforced.read_only === true && isReadOnly) ||
(this.passwordEnforced.upload_only === true && isUploadOnly) ||
(this.passwordEnforced.read_write === true && isReadWrite) ||
(this.passwordEnforced.read_write_delete === true && isReadWriteDelete)
)
},
addNewLink() {
Expand Down

0 comments on commit ba644f6

Please sign in to comment.