metacatui icon indicating copy to clipboard operation
metacatui copied to clipboard

Adds `enablePublishOnAllNonPublic` configuration

Open helbashandy opened this issue 2 years ago • 4 comments

Description

Adds enablePublishOnAllNonPublic configuration. If true, users can see a "Publish" button in the MetadataView on all non-public datasets regardless if a DOI is assigned to the dataset. If false, the default behavior would take place based on the AppConfig#enablePublishDOI config.

closes #2202

helbashandy avatar Oct 17 '23 18:10 helbashandy

@rushirajnenuji I imagine that your work on hierarchical folders could involve lots of changes to the MetadataView. Does this PR conflict with any of your work?

robyngit avatar Oct 18 '23 12:10 robyngit

Thank you @robyngit and @helbashandy -- I'll review the code to see any conflicts with MDV and get back.

rushirajnenuji avatar Oct 18 '23 18:10 rushirajnenuji

@helbashandy not sure what the expected behaviour is for ESS-DIVE, but it seems intuitive that if enablePublishDOI is false, the publish button should never show up. Likewise if publishing is limited to those in the enablePublishDOIForSubjects list, and the user isn’t authorized, then the publish button should never show up. So if we were to move this decision into its own method, the logic would be something like...

canBePublished: function () {

  // The Publish feature has to be enabled in the app. 
  if (!MetacatUI.appModel.get("enablePublishDOI")) {
    return false;
  }

  // If the repository is configured to limit publishing to only certain
  // users and groups, then check if the logged-in user is one of the
  // subjects in the list or is in a group that is in the list. If not,
  // then this metadata cannot be published.
  const authorizedPublishers = MetacatUI.appModel.get("enablePublishDOIForSubjects");
  const authorizedOnly = Array.isArray(authorizedPublishers) &&
    (authorizedPublishers.length);
  const userIsAuthorized = authorizedOnly &&
    MetacatUI.appUserModel.hasIdentityOverlap(authorizedPublishers);
  if (authorizedOnly && !userIsAuthorized) {
    return false;
  }

  // Finally, if the setting to enable publishing on all private
  // metadata is enabled, then allow publishing if the metadata is not
  // yet public. Otherwise, allow publishing if there's not a DOI yet.
  const isPrivate = !this.get("isPublic")
  const isDOI = model.isDOI()
  const enablePublishOnAllPrivate = MetacatUI.appModel.get("enablePublishOnAllPrivate");
  if ((enablePublishOnAllPrivate && isPrivate) || !isDOI) {
    return true;
  }

  // Otherwise, this metadata cannot be published.
  return false;

},

What do you think?

robyngit avatar Oct 23 '23 20:10 robyngit

Hey @helbashandy, wondering if ESS-Dive is still hoping to merge in these changes and add a enablePublishOnAllNonPublic config option?

robyngit avatar Apr 01 '24 16:04 robyngit

I will close this PR for now since it hasn't had attention for 7+ months, but @helbashandy please re-open if you're still wanting to get this merged into MetacatUI!

robyngit avatar Jun 04 '24 20:06 robyngit

Hi Robyn,

I apologize for the delayed response. Regarding the pending PR, we were in the process of finalizing design changes that impact the ESS-DIVE user journey for publication requests. After consideration of our current use-cases, we determined that the suggested configuration change is no longer necessary.

The current design includes an additional modal triggered by the publication button, which addresses various use cases beyond what the suggested configuration would have covered. As a result, integrating the config change is not currently a priority for ESS-DIVE's UI and user journey flow.

Thank you for your patience and for following up on the PR. Let me know if you have any further questions.

helbashandy avatar Jun 04 '24 21:06 helbashandy

Thanks @helbashandy ! I figured you had taken a different path, but just didn't want to assume :)

robyngit avatar Jun 04 '24 21:06 robyngit