-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Labels
Description
Summary
The UI lets you select Datasets you don't own (Public Data) when creating a PublishedData but trying to publish it will actually fail because it tries to set isPublished to true but the user doesn't have permissions for updating this kind of dataset
Steps to Reproduce
Select a public dataset when creating a PublishedData, fill in all required metadata, and try to publish it from the UI.
Current Behaviour
Fails with 403
Expected Behaviour
Option 1: disallow selection of datasets for which you don't have write access (update) in the UI
Option 2: don't fail/update if the dataset is already public
relevant code:
scicat-backend-next/src/published-data/published-data.v4.controller.ts
Lines 421 to 429 in 5839241
| // Make datasets in publishedData datasetPids array public | |
| const datasetPids = publishedData.datasetPids; | |
| await Promise.all( | |
| datasetPids.map(async (pid) => { | |
| await this.datasetsController.findByIdAndUpdate(request, pid, { | |
| isPublished: true, | |
| }); | |
| }), | |
| ); |