Skip to content

Commit

Permalink
YDA-5747: give readers access to vault package
Browse files Browse the repository at this point in the history
  • Loading branch information
claravox authored Jul 30, 2024
1 parent adfc636 commit ca28eb3
Show file tree
Hide file tree
Showing 8 changed files with 177 additions and 98 deletions.
2 changes: 1 addition & 1 deletion browse.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def _filter_vault_deposit_index(row):
:param row: row of results data from GenQuery, containing collection name (COLL_NAME)
:returns: boolean value that indicated whether row should be displayed
:returns: boolean value that indicates whether row should be displayed
"""
# Remove ORDER_BY etc. wrappers from column names.
x = {re.sub('.*\((.*)\)', '\\1', k): v for k, v in row.items()}
Expand Down
2 changes: 1 addition & 1 deletion groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def getGroupsData(ctx):
user = row[1]
zone = row[2]

if name != user and name != "rodsadmin" and name != "public":
if name not in (user, 'rodsadmin', 'public'):
user = user + "#" + zone
if name.startswith("read-"):
# Match read-* group with research-* or initial-* group.
Expand Down
2 changes: 1 addition & 1 deletion tests/features/api/api_vault.feature
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ Feature: Vault API
| /tempZone/home/vault-default-3 |


Scenario Outline: Revoke grant access to research group
Scenario Outline: Grant read access to research group
Given user datamanager is authenticated
And data package exists in <vault>
And the Yoda vault grant read access research group API is queried on datapackage in <vault>
Expand Down
10 changes: 5 additions & 5 deletions tests/features/smoke/smoke_test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -255,19 +255,19 @@ Feature: Smoke tests
Then the response status code is "200"

Examples:
| vault |
| /tempZone/home/vault-smoke-test |
| vault |
| /tempZone/home/vault-smoke-test |


Scenario Outline: Vault revoke grant access to research group
Scenario Outline: Vault grant read access to research group
Given user smoke_account is authenticated
And data package exists in <vault>
And the Yoda vault grant read access research group API is queried on datapackage in <vault>
Then the response status code is "200"

Examples:
| vault |
| /tempZone/home/vault-smoke-test |
| vault |
| /tempZone/home/vault-smoke-test |


Scenario Outline: Vault get publication terms
Expand Down
2 changes: 1 addition & 1 deletion tests/features/ui/ui_browse.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Feature: Browse UI
#Then content of sub-folder <folder> is shown

Examples:
| user | folder |
| user | folder |
| researcher | vault-core-1 |
| researcher | vault-default-2 |
| researcher | vault-core-2 |
Expand Down
34 changes: 29 additions & 5 deletions tests/features/ui/ui_vault.feature
Original file line number Diff line number Diff line change
Expand Up @@ -170,26 +170,50 @@ Feature: Vault UI
Given user datamanager is logged in
And module "vault" is shown
When user browses to data package in <vault>
And user clicks action menu to revoke access
Then action menu holds option to grant access to research group
And user clicks action menu to change access
Then revoke text is displayed
When user confirms revoke read permissions

Examples:
| vault |
| vault-initial1 |


Scenario Outline: Research group user has had access revoked to vault package
Given user <user> is logged in
When user browses to previous vault package url
Then user does not have access to folder

Examples:
| user |
| researcher |
| viewer |


Scenario Outline: Grant read access to research group
Given user datamanager is logged in
And module "vault" is shown
When user browses to data package in <vault>
And clicks action menu to grant access
Then action menu holds option to revoke access from research group
And user clicks action menu to change access
Then grant text is displayed
When user confirms grant read permissions

Examples:
| vault |
| vault-initial1 |


Scenario Outline: Research group user has been granted access to vault package
Given user <user> is logged in
When user browses to previous vault package url
Then contents of folder are shown

Examples:
| user | vault |
| researcher | vault-initial1 |
| viewer | vault-initial1 |


Scenario Outline: Copy datapackage to research space
Given user datamanager is logged in
And module "vault" is shown
Expand Down Expand Up @@ -238,4 +262,4 @@ Feature: Vault UI

Examples:
| vault | group |
| vault-initial1 | research-initial1 |
| vault-initial1 | research-initial1 |
65 changes: 46 additions & 19 deletions tests/step_defs/ui/test_ui_vault.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding=utf-8
"""Vault UI feature tests."""

__copyright__ = 'Copyright (c) 2020-2022, Utrecht University'
__copyright__ = 'Copyright (c) 2020-2024, Utrecht University'
__license__ = 'GPLv3, see LICENSE'

import time
Expand All @@ -15,9 +15,12 @@

scenarios('../../features/ui/ui_vault.feature')

previous_vault_path = ''


@when(parsers.parse("user browses to data package in {vault}"))
def ui_browse_data_package(browser, vault):
global previous_vault_path
link = []
while len(link) == 0:
link = browser.links.find_by_partial_text(vault)
Expand All @@ -31,6 +34,7 @@ def ui_browse_data_package(browser, vault):
research = vault.replace("vault-", "research-")
data_packages = browser.links.find_by_partial_text(research)
data_packages.click()
previous_vault_path = browser.driver.current_url


@when('user submits the data package for publication')
Expand Down Expand Up @@ -157,36 +161,59 @@ def ui_data_package_provenance_information_is_visible(browser):
assert browser.find_by_css('.actionlog', wait_time=5).is_visible()


@when('user clicks action menu to revoke access')
def ui_data_package_revoke_vault_access(browser):
@when('user clicks action menu to change access')
def ui_data_package_change_vault_access(browser):
browser.find_by_id('actionMenu').click()
browser.find_by_css('a.action-revoke-vault-access').click()
browser.find_by_css('a.action-change-vault-access').click()


@then('action menu holds option to grant access to research group')
def ui_data_package_grant_option_present(browser):
browser.find_by_id('actionMenu').click()
assert browser.is_element_present_by_css('.action-grant-vault-access')
@then('revoke text is displayed')
def ui_data_package_revoke_message(browser):
time.sleep(3)
assert browser.is_text_present('revoke')


@when('clicks action menu to grant access')
def ui_data_package_grant_vault_access(browser):
browser.find_by_id('actionMenu').click()
browser.find_by_css('a.action-grant-vault-access').click()
@then('grant text is displayed')
def ui_data_package_grant_message(browser):
time.sleep(3)
assert browser.is_text_present('grant')


@then('action menu holds option to revoke access from research group')
def ui_data_package_revoke_option_present(browser):
browser.find_by_id('actionMenu').click()
assert browser.is_element_present_by_css('.action-revoke-vault-access')
@when("user confirms revoke read permissions")
def ui_data_package_revoke_read_permissions_confirm(browser):
browser.find_by_css(".action-confirm-revoke-read-permissions").click()


@when("user confirms grant read permissions")
def ui_data_package_grant_read_permissions_confirm(browser):
browser.find_by_css(".action-confirm-grant-read-permissions").click()


@when('user clicks action menu to copy data package to research')
def ui_data_package_copy_to_resarch(browser):
def ui_data_package_copy_to_research(browser):
browser.find_by_id('actionMenu').click()
browser.find_by_css('a.action-copy-vault-package-to-research').click()


@when('user browses to previous vault package url')
def ui_data_package_browses_previous_url(browser):
if len(previous_vault_path):
browser.visit(previous_vault_path)
else:
assert False


@then('contents of folder are shown')
def ui_data_package_contents(browser):
assert browser.is_text_present('yoda-metadata')
assert browser.is_text_present('original')


@then('user does not have access to folder')
def ui_data_package_no_access(browser):
assert browser.is_text_present('This vault space path does not exist')


@when(parsers.parse("user chooses research folder corresponding to {vault}"))
def ui_browse_research_to_copy_data_package_to(browser, vault):
research = vault.replace("vault-", "research-")
Expand All @@ -207,8 +234,8 @@ def ui_user_presses_copy_package_button(browser):

@then('data package is copied to research area')
def ui_data_package_is_copied_to_research(browser):
browser.find_by_id('actionMenu').click()
browser.is_element_present_by_css('.action-revoke-vault-access')
# TODO
pass


@when('user clicks clicks action menu to check compliance')
Expand Down
Loading

0 comments on commit ca28eb3

Please sign in to comment.