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

[ENG-2814][ENG-4816] Allow Read-only and Read/Write contributors to view a project's draft registrations #10468

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

Johnetordoff
Copy link
Contributor

@Johnetordoff Johnetordoff commented Oct 19, 2023

Purpose

Change permissions for DraftRegistrations so Read/Write contributors can view all listed DraftRegistrations for a node.

GET for reading, POST for DR creation and PATCH for editing

Role Method Read Write Admin
Node GET Yes Yes Yes
Node POST No No Yes
Node PATCH No Yes Yes
Role Method Read Write Admin
Draft GET Yes Yes Yes
Draft POST No No Yes
Draft PATCH No Yes Yes

Changes

  • Add new permissions class NodeDraftRegistrationsListPermission to NodeDraftRegistrationsList
  • Break up test runner into separate classes
  • Split apart large single test functions into individual cases
  • add more to testing matrix test_<user_permission>_draft_not_node has all cases

QA Notes

old test structure:

DraftRegistrationTestCase
├── TestDraftRegistrationDetail
│   └── TestDraftRegistrationDetailEndpoint
├── TestDraftRegistrationList
│   └── TestDraftRegistrationListNewWorkflow
├── TestDraftRegistrationCreate
│   ├── TestDraftRegistrationCreateWithNode
│   └── TestDraftRegistrationCreateWithoutNode
├── TestDraftRegistrationUpdate
├── TestDraftRegistrationPatch
├── TestDraftRegistrationDelete
├── TestDraftRegistrationList
├── TestDraftRegistrationCreate
└── TestNodeRegistrationCreate

new flat structure DraftRegistrationTestCase is refactored as AbstractDraftRegistrationTestCase:

 AbstractDraftRegistrationTestCase
├── TestDraftRegistrationDetail
├── TestDraftRegistrationDetailEndpoint
├── TestDraftRegistrationListNewWorkflow
├── TestDraftRegistrationCreateWithNode
├── TestDraftRegistrationCreateWithoutNode
├── TestDraftRegistrationUpdate
├── TestDraftRegistrationPatch
├── TestDraftRegistrationDelete
├── TestDraftRegistrationList
├── TestDraftRegistrationCreate
├── TestNodeRegistrationCreate
├── TestDraftRegistrationList

What are the areas of risk?

Any concerns/considerations/questions that development raised?

Documentation

Side Effects

Because this dealt this tests that covered two permissions cases that acted differently I decided to split-up and partially re-write these tests.

Ticket

https://openscience.atlassian.net/browse/ENG-2814
https://openscience.atlassian.net/browse/ENG-4816

@Johnetordoff Johnetordoff force-pushed the draft-registration-permissions branch 17 times, most recently from bed1532 to 307b1b9 Compare October 23, 2023 15:49
@Johnetordoff Johnetordoff changed the title [ENG-2814] Allow Read-only and Read/Write contributors to view a project's draft registrations [ENG-2814][ENG-4816] Allow Read-only and Read/Write contributors to view a project's draft registrations Oct 23, 2023
@Johnetordoff Johnetordoff force-pushed the draft-registration-permissions branch 3 times, most recently from 2607084 to 5b4f69a Compare October 23, 2023 18:04
@@ -548,9 +564,8 @@ def test_write_contributor_can_update_draft(
assert data['attributes']['registration_metadata'] == payload['data']['attributes']['registration_metadata']


class TestDraftRegistrationDelete(TestDraftRegistrationDelete):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just changing this name to not mirror the superclass

@Johnetordoff Johnetordoff force-pushed the draft-registration-permissions branch 4 times, most recently from 2703b3f to 81420b7 Compare October 23, 2023 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant