diff --git a/doc/release-notes/359-enhance-publishing-message-acknowledgement.md b/doc/release-notes/359-enhance-publishing-message-acknowledgement.md new file mode 100644 index 00000000000..69194182cb0 --- /dev/null +++ b/doc/release-notes/359-enhance-publishing-message-acknowledgement.md @@ -0,0 +1,21 @@ +## Publishing Enhancement ## + +Before a Dataset can be published the user must acknowledge acceptance of the disclaimer if it is required. + +The setting "PublishDatasetDisclaimerText", when set, will prevent a draft dataset from being published without the user acknowledging the disclaimer. +The approved disclaimer text is `"By publishing this dataset, I fully accept all legal responsibility for ensuring that the deposited content is: anonymized, free of copyright violations, and contains data that is computationally reusable. I understand and agree that any violation of these conditions may result in the immediate removal of the dataset by the repository without prior notice."` + +To enable/disable the acknowledgement requirement an Admin can set/delete the setting using the following APIs: + +`curl -X PUT -d "By publishing this dataset, I fully accept all legal responsibility for ensuring that the deposited content is: anonymized, free of copyright violations, and contains data that is computationally reusable. I understand and agree that any violation of these conditions may result in the immediate removal of the dataset by the repository without prior notice." http://localhost:8080/api/admin/settings/:PublishDatasetDisclaimerText` + +`curl -X DELETE http://localhost:8080/api/admin/settings/:PublishDatasetDisclaimerText` + +The UI will prevent the user from publishing a Dataset unless the disclaimer is acknowledged. + +The APIs will continue to publish without the acknowledgement for now. An Info API getter was added for non-superusers to get the disclaimer text. + +`curl -X GET http://localhost:8080/api/info/settings/:PublishDatasetDisclaimerText` + +See: +- [#359](https://github.com/IQSS/dataverse.harvard.edu/issues/359) diff --git a/doc/sphinx-guides/source/api/native-api.rst b/doc/sphinx-guides/source/api/native-api.rst index 20ff079f5a3..eab71f8623b 100644 --- a/doc/sphinx-guides/source/api/native-api.rst +++ b/doc/sphinx-guides/source/api/native-api.rst @@ -6366,11 +6366,14 @@ The fully expanded example above (without environment variables) looks like this curl "https://demo.dataverse.org/api/info/server" +.. _show-custom-popup-for-publishing-datasets: + Show Custom Popup Text for Publishing Datasets ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For now, only the value for the :ref:`:DatasetPublishPopupCustomText` setting from the Configuration section of the Installation Guide is exposed: +.. note:: See :ref:`show-disclaimer-for-publishing-datasets` if you want the user to acknowledge before publishing. .. note:: See :ref:`curl-examples-and-environment-variables` if you are unfamiliar with the use of export below. .. code-block:: bash @@ -6385,6 +6388,28 @@ The fully expanded example above (without environment variables) looks like this curl "https://demo.dataverse.org/api/info/settings/:DatasetPublishPopupCustomText" +.. _show-disclaimer-for-publishing-datasets: + +Show Disclaimer for Publishing Datasets +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The setting "PublishDatasetDisclaimerText", when set, will prevent a draft dataset from being published through the UI without the user acknowledging the disclaimer. + +.. note:: See :ref:`show-custom-popup-for-publishing-datasets` if the user acknowledgment is not required but you want the message to be displayed in the UI. +.. note:: See :ref:`curl-examples-and-environment-variables` if you are unfamiliar with the use of export below. + +.. code-block:: bash + + export SERVER_URL=https://demo.dataverse.org + + curl "$SERVER_URL/api/info/settings/:PublishDatasetDisclaimerText" + +The fully expanded example above (without environment variables) looks like this: + +.. code-block:: bash + + curl "https://demo.dataverse.org/api/info/settings/:PublishDatasetDisclaimerText" + .. _api-get-app-tou: Get Application Terms of Use (General Terms of Use) diff --git a/doc/sphinx-guides/source/installation/config.rst b/doc/sphinx-guides/source/installation/config.rst index a9d5c7c0041..07084d8b126 100644 --- a/doc/sphinx-guides/source/installation/config.rst +++ b/doc/sphinx-guides/source/installation/config.rst @@ -5289,6 +5289,15 @@ This post-publish workflow is useful for actions such as sending notifications a See :ref:`Workflow Admin section ` for more details and context. +.. _:PublishDatasetDisclaimerText: + +:PublishDatasetDisclaimerText ++++++++++++++++++++++++++++++ + +The text displayed to the user that must be acknowledged prior to publishing a Dataset. When not set the acknowledgment is not required nor displayed. + +``curl -X PUT -d "By publishing this dataset, I fully accept all legal responsibility for ensuring that the deposited content is: anonymized, free of copyright violations, and contains data that is computationally reusable. I understand and agree that any violation of these conditions may result in the immediate removal of the dataset by the repository without prior notice." http://localhost:8080/api/admin/settings/:PublishDatasetDisclaimerText`` + .. _:BagItHandlerEnabled: :BagItHandlerEnabled diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java index 20617160a1c..d0c1eb239f6 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java @@ -1,8 +1,5 @@ package edu.harvard.iq.dataverse; -import edu.harvard.iq.dataverse.authorization.DataverseRole; -import edu.harvard.iq.dataverse.engine.command.DataverseRequest; -import edu.harvard.iq.dataverse.globus.Permissions; import edu.harvard.iq.dataverse.provenance.ProvPopupFragmentBean; import edu.harvard.iq.dataverse.api.AbstractApiBean; import edu.harvard.iq.dataverse.authorization.AuthenticationServiceBean; @@ -6251,6 +6248,7 @@ public void setFileMetadataForAction(FileMetadata fileMetadataForAction) { private String termsOfAccess; private boolean fileAccessRequest; + private boolean publishDisclaimerAcknowledged; public String getTermsOfAccess() { return termsOfAccess; @@ -6268,6 +6266,14 @@ public void setFileAccessRequest(boolean fileAccessRequest) { this.fileAccessRequest = fileAccessRequest; } + public boolean isPublishDisclaimerAcknowledged() { + return publishDisclaimerAcknowledged || !settingsWrapper.isHasPublishDatasetDisclaimerText(); + } + + public void setPublishDisclaimerAcknowledged(boolean publishDisclaimerAcknowledged) { + this.publishDisclaimerAcknowledged = publishDisclaimerAcknowledged; + } + // wrapper method to see if the file has been deleted (or replaced) in the current version public boolean isFileDeleted (DataFile dataFile) { if (dataFile.getDeleted() == null) { diff --git a/src/main/java/edu/harvard/iq/dataverse/SettingsWrapper.java b/src/main/java/edu/harvard/iq/dataverse/SettingsWrapper.java index 23a26a8cf2c..23db066dc14 100644 --- a/src/main/java/edu/harvard/iq/dataverse/SettingsWrapper.java +++ b/src/main/java/edu/harvard/iq/dataverse/SettingsWrapper.java @@ -124,7 +124,9 @@ public class SettingsWrapper implements java.io.Serializable { private Boolean webloaderUpload = null; - private String metricsUrl = null; + private String metricsUrl = null; + + private String publishDatasetDisclaimerText = null; private Boolean dataFilePIDSequentialDependent = null; @@ -872,4 +874,15 @@ public List getSystemMetadataBlocks() { return systemMetadataBlocks; } -} \ No newline at end of file + + public String getPublishDatasetDisclaimerText() { + if (publishDatasetDisclaimerText == null) { + publishDatasetDisclaimerText = getValueForKey(Key.PublishDatasetDisclaimerText); + } + return publishDatasetDisclaimerText; + } + + public Boolean isHasPublishDatasetDisclaimerText() { + return !StringUtil.isEmpty(getPublishDatasetDisclaimerText()); + } +} diff --git a/src/main/java/edu/harvard/iq/dataverse/api/Info.java b/src/main/java/edu/harvard/iq/dataverse/api/Info.java index 45539424e85..1aab185e6fb 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/Info.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/Info.java @@ -46,6 +46,12 @@ public Response getDatasetPublishPopupCustomText() { return getSettingResponseByKey(SettingsServiceBean.Key.DatasetPublishPopupCustomText); } + @GET + @Path("settings/:PublishDatasetDisclaimerText") + public Response getPublishDatasetDisclaimerText() { + return getSettingResponseByKey(SettingsServiceBean.Key.PublishDatasetDisclaimerText); + } + @GET @Path("settings/:MaxEmbargoDurationInMonths") public Response getMaxEmbargoDurationInMonths() { diff --git a/src/main/java/edu/harvard/iq/dataverse/settings/SettingsServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/settings/SettingsServiceBean.java index 965f0dd9740..98578eed8d7 100644 --- a/src/main/java/edu/harvard/iq/dataverse/settings/SettingsServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/settings/SettingsServiceBean.java @@ -326,6 +326,10 @@

Size limit (in bytes) for tabular file ingest. Accepts either a single numeri */ DatasetPublishPopupCustomTextOnAllVersions, /* + Publish Disclaimer text. If this setting exists user must acknowledge before a Dataset can be published + */ + PublishDatasetDisclaimerText, + /* Whether Harvesting (OAI) service is enabled */ OAIServerEnabled, diff --git a/src/main/webapp/dataset.xhtml b/src/main/webapp/dataset.xhtml index daea69524d6..55c1d115b66 100644 --- a/src/main/webapp/dataset.xhtml +++ b/src/main/webapp/dataset.xhtml @@ -2030,8 +2030,18 @@

#{bundle['dataset.publish.terms.help.tip']}

+ +
+ + + +
+
-