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
Adds enablePublishOnAllNonPublic
configuration
#2203
base: develop
Are you sure you want to change the base?
Conversation
d583c02
to
bca1b3f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@helbashandy this looks great, thanks! Could you please just update the comments above your code changes to describe the new decision process?
* a DOI is assigned to the dataset | ||
* If false, the default behavior would take place based on the {@link AppConfig#enablePublishDOI} config. | ||
* @type {boolean} | ||
* @default false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When this gets released, I update all the @SInCE x.x.x with the new version.
* @default false | |
* @default false | |
* @since x.x.x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@robyngit - Done! I added the version to be 2.27.0
. Please let me know if you are planning to introduce this change with a different release version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's perfect @helbashandy, thank you! In the future, just use x.x.x
as the version - these are all replaced with the actual version number at the time of release - that way there's flexibility if something has to get pushed to a different release, or the version # changes for any reason.
@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? |
enablePublishOnAllNonPublic
configuration
bca1b3f
to
73d8e5c
Compare
Thank you @robyngit and @helbashandy -- I'll review the code to see any conflicts with MDV and get back. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @robyngit and @helbashandy -- I reviewed this PR and it looks good. There are some minor conflicts with the MetaDataView, but it should be easy to merge into my branch. Thank you for checking.
@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? |
Hey @helbashandy, wondering if ESS-Dive is still hoping to merge in these changes and add a enablePublishOnAllNonPublic config option? |
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 theAppConfig#enablePublishDOI
config.closes #2202