Skip to content

Commit

Permalink
Show password prompt if role change on public link enforces password
Browse files Browse the repository at this point in the history
Trigger Build

Show error message if password ist empty

Don't use imported

Fix acceptance tests

Add changelog for #6989

Sort out acceptance test line numbers

Sort out acceptance test line numbers

Sort out acceptance test line numbers
  • Loading branch information
JanAckermann authored and pascalwengerter committed May 17, 2022
1 parent bd4bb5f commit 7d9bf36
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
7 changes: 7 additions & 0 deletions changelog/unreleased/bugfix-link-permission-enforced-password
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: Changing link permissions to role requiring password

We have added a dialogue option for updates of a link's permissions to a new role that would require a password.
It now prompts the user to add a password instead of failing directly.

https://github.com/owncloud/web/pull/6989
https://github.com/owncloud/web/issues/6974
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ import { DateTime } from 'luxon'
import { mapActions } from 'vuex'
import Mixins from '../../../../mixins'
import { createLocationSpaces, isLocationSpacesActive } from '../../../../router'
import { showQuickLinkPasswordModal } from '../../../../quickActions'
import { LinkShareRoles, SharePermissions } from '../../../../helpers/share'
export default {
Expand Down Expand Up @@ -392,9 +393,16 @@ export default {
onSuccess = () => {}
}) {
if (this.checkPasswordEnforcedFor(link) && link.password === false) {
this.showMessage({
title: this.$gettext('Role requires password to be set for link'),
status: 'warning'
showQuickLinkPasswordModal({ store: this.$store }, (password) => {
if (!password || password.trim() === '') {
return this.showMessage({
title: this.$gettext('Password cannot be empty'),
status: 'danger'
})
}
link.password = password
this.$emit('updateLink', { link, onSuccess })
this.hideModal()
})
} else {
this.$emit('updateLink', { link, onSuccess })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Feature: Edit public link shares
Background:
Given user "Alice" has been created with default attributes and without skeleton files in the server


@issue-ocis-1328
Scenario Outline: user tries to change the role of an existing public link role without entering share password while enforce password for that role is enforced
Given the setting "<setting-name>" of app "core" has been set to "yes" in the server
Expand All @@ -18,7 +17,8 @@ Feature: Edit public link shares
| permissions | <initial-permissions> |
And user "Alice" has logged in using the webUI
When the user tries to edit the public link named "Public-link" of folder "simple-folder" changing the role to "<role>"
Then the user should see an error message on the public link share dialog saying "Role requires password to be set for link"
Then the user should see a password modal dialog with message "Passwords for links are required." on the webUI
# Doesn't check settings the password
And user "Alice" should have a share with these details in the server:
| field | value |
| share_type | public_link |
Expand All @@ -33,7 +33,6 @@ Feature: Edit public link shares
| read, create | Uploader | shareapi_enforce_links_password_write_only |



@issue-ocis-1328
Scenario Outline: user tries to delete the password of an existing public link role while enforce password for that role is enforced
Given the setting "<setting-name>" of app "core" has been set to "yes" in the server
Expand Down
9 changes: 9 additions & 0 deletions tests/acceptance/stepDefinitions/publicLinkContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,15 @@ When(
}
)

Then(
'the user should see a password modal dialog with message {string} on the webUI',
async function (expectedMessage) {
const actualMessage =
await client.page.FilesPageElement.publicLinksDialog().getErrorMessageFromModal()
return client.assert.strictEqual(actualMessage, expectedMessage)
}
)

When(
'the user tries to edit the public link named {string} of file/folder/resource {string} changing the role to {string}',
async function (linkName, resource, role) {
Expand Down

0 comments on commit 7d9bf36

Please sign in to comment.