Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't run into early return in password enforcement check #8623

Merged
merged 1 commit into from
Mar 15, 2023
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: 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