Skip to content
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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/js/models/AppModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,20 @@ define(['jquery', 'underscore', 'backbone'],
*/
isJSONLDEnabled: true,

/**
* 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 {@link AppConfig#enablePublishDOI} config.
*
* This config helps in the case that a member-node publication workflow requires review of the datasets before
* they can be public. It also allows datasets to be reviewed for publication regardless of the DOI status,
* as some datasets could have a pre-assigned DOI when transferring their dataset to a member node.
* @type {boolean}
* @default false
Copy link
Member

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.

Suggested change
* @default false
* @default false
* @since x.x.x

Copy link
Collaborator Author

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.

Copy link
Member

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.

* @since 2.27.0
*/
enablePublishOnAllNonPublic: false,

/**
* If true, users can see a "Publish" button in the MetadataView, which makes the metadata
* document public and gives it a DOI identifier.
Expand Down
19 changes: 15 additions & 4 deletions src/js/views/MetadataView.js
Original file line number Diff line number Diff line change
Expand Up @@ -1231,19 +1231,30 @@ define(['jquery',
}

try {
//Determine if this metadata can be published.
// Determine if this metadata can be published.
// The Publish feature has to be enabled in the app.
// The model cannot already have a DOI
var canBePublished = MetacatUI.appModel.get("enablePublishDOI") && !view.model.isDOI();
var canBePublished;

// Check if this metadata can be published based on the "enablePublishOnAllNonPublic" Configuration.
// This helps in the case that a member-node publication workflow requires review of the datasets before
// they can be public. It also allows datasets to be reviewed for publication regardless of the DOI status,
// as some datasets could have a pre-assigned DOI when transferring their dataset to a member node.
if (MetacatUI.appModel.get("enablePublishOnAllNonPublic") && view.model.get("isPublic") === false){
canBePublished = true;
} else {
canBePublished = MetacatUI.appModel.get("enablePublishDOI") && !view.model.isDOI();
}

//If publishing is enabled, check if only certain users and groups can publish metadata
if (canBePublished) {
//Get the list of authorized publishers from the AppModel
var authorizedPublishers = MetacatUI.appModel.get("enablePublishDOIForSubjects");
//If the logged-in user is one of the subjects in the list or is in a group that is
// in the list, then this metadata can be published. Otherwise, it cannot.
if (Array.isArray(authorizedPublishers) && authorizedPublishers.length) {
if (MetacatUI.appUserModel.hasIdentityOverlap(authorizedPublishers)) {
if (Array.isArray(authorizedPublishers) && (authorizedPublishers.length ||
!view.model.get("isPublic") === false)){
if (MetacatUI.appUserModel.hasIdentityOverlap(authorizedPublishers)){
canBePublished = true;
}
else {
Expand Down