osf.io icon indicating copy to clipboard operation
osf.io copied to clipboard

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

Open Johnetordoff opened this issue 1 year ago • 0 comments

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 avatar Oct 19 '23 12:10 Johnetordoff