Panoptes-Front-End icon indicating copy to clipboard operation
Panoptes-Front-End copied to clipboard

Pages Editor: check if workflow is part of project

Open shaunanoordin opened this issue 6 months ago • 1 comments

PR Overview

Staging branch URL: https://pr-7156.pfe-preview.zooniverse.org/lab/1982/workflows/editor/3711?env=staging

This PR fixes an issue where it's possible to view/edit a Workflow in the incorrect Project.

The Issue:

  • e.g. if you have a WF 1111 that's part of project 22, you can still access that WF at the URL for project 44: /lab/44/workflows/editor/1111 This is clearly incorrect.
  • Note that this issue exists even with the PFE workflow editor, i.e. /lab/44/workflows/1111 still allows you to edit the WF on an incorrect project. This is a separate issue to be fixed.

The Fix:

  • Add checkIsWorkflowPartOfProject() helper that returns true if, and only if, the Workflow is linked to the Project.
  • Add error message if the Workflow isn't part of the higher-level Project.

Testing

For the following tests, staging WF 3711 belongs to project 1982, not 1992.

  • This URL should display the Pages Editor for the workflow: https://pr-7156.pfe-preview.zooniverse.org/lab/1982/workflows/editor/3711?env=staging
    • compare and contrast with master: https://master.pfe-preview.zooniverse.org/lab/1982/workflows/editor/3711?env=staging
  • This URL should return an error, because the workflow doesn't belong to the project: https://pr-7156.pfe-preview.zooniverse.org/lab/1992/workflows/editor/3711?env=staging
    • compare and contrast with master: https://master.pfe-preview.zooniverse.org/lab/1992/workflows/editor/3711?env=staging

Status

Ready to go

shaunanoordin avatar Aug 21 '24 16:08 shaunanoordin