Skip to content

Commit 180aa55

Browse files
authored
Merge pull request #12051 from IQSS/359-enhance-publishing-message-acknowledgement
Add acknowledgment before publishing
2 parents c91f059 + 2bf9934 commit 180aa55

9 files changed

Lines changed: 109 additions & 9 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## Publishing Enhancement ##
2+
3+
Before a Dataset can be published the user must acknowledge acceptance of the disclaimer if it is required.
4+
5+
The setting "PublishDatasetDisclaimerText", when set, will prevent a draft dataset from being published without the user acknowledging the disclaimer.
6+
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."`
7+
8+
To enable/disable the acknowledgement requirement an Admin can set/delete the setting using the following APIs:
9+
10+
`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`
11+
12+
`curl -X DELETE http://localhost:8080/api/admin/settings/:PublishDatasetDisclaimerText`
13+
14+
The UI will prevent the user from publishing a Dataset unless the disclaimer is acknowledged.
15+
16+
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.
17+
18+
`curl -X GET http://localhost:8080/api/info/settings/:PublishDatasetDisclaimerText`
19+
20+
See:
21+
- [#359](https://github.com/IQSS/dataverse.harvard.edu/issues/359)

doc/sphinx-guides/source/api/native-api.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6366,11 +6366,14 @@ The fully expanded example above (without environment variables) looks like this
63666366
63676367
curl "https://demo.dataverse.org/api/info/server"
63686368
6369+
.. _show-custom-popup-for-publishing-datasets:
6370+
63696371
Show Custom Popup Text for Publishing Datasets
63706372
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63716373
63726374
For now, only the value for the :ref:`:DatasetPublishPopupCustomText` setting from the Configuration section of the Installation Guide is exposed:
63736375
6376+
.. note:: See :ref:`show-disclaimer-for-publishing-datasets` if you want the user to acknowledge before publishing.
63746377
.. note:: See :ref:`curl-examples-and-environment-variables` if you are unfamiliar with the use of export below.
63756378
63766379
.. code-block:: bash
@@ -6385,6 +6388,28 @@ The fully expanded example above (without environment variables) looks like this
63856388
63866389
curl "https://demo.dataverse.org/api/info/settings/:DatasetPublishPopupCustomText"
63876390
6391+
.. _show-disclaimer-for-publishing-datasets:
6392+
6393+
Show Disclaimer for Publishing Datasets
6394+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6395+
6396+
The setting "PublishDatasetDisclaimerText", when set, will prevent a draft dataset from being published through the UI without the user acknowledging the disclaimer.
6397+
6398+
.. 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.
6399+
.. note:: See :ref:`curl-examples-and-environment-variables` if you are unfamiliar with the use of export below.
6400+
6401+
.. code-block:: bash
6402+
6403+
export SERVER_URL=https://demo.dataverse.org
6404+
6405+
curl "$SERVER_URL/api/info/settings/:PublishDatasetDisclaimerText"
6406+
6407+
The fully expanded example above (without environment variables) looks like this:
6408+
6409+
.. code-block:: bash
6410+
6411+
curl "https://demo.dataverse.org/api/info/settings/:PublishDatasetDisclaimerText"
6412+
63886413
.. _api-get-app-tou:
63896414
63906415
Get Application Terms of Use (General Terms of Use)

doc/sphinx-guides/source/installation/config.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5289,6 +5289,15 @@ This post-publish workflow is useful for actions such as sending notifications a
52895289

52905290
See :ref:`Workflow Admin section <workflow_admin>` for more details and context.
52915291

5292+
.. _:PublishDatasetDisclaimerText:
5293+
5294+
:PublishDatasetDisclaimerText
5295+
+++++++++++++++++++++++++++++
5296+
5297+
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.
5298+
5299+
``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``
5300+
52925301
.. _:BagItHandlerEnabled:
52935302

52945303
:BagItHandlerEnabled

src/main/java/edu/harvard/iq/dataverse/DatasetPage.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package edu.harvard.iq.dataverse;
22

3-
import edu.harvard.iq.dataverse.authorization.DataverseRole;
4-
import edu.harvard.iq.dataverse.engine.command.DataverseRequest;
5-
import edu.harvard.iq.dataverse.globus.Permissions;
63
import edu.harvard.iq.dataverse.provenance.ProvPopupFragmentBean;
74
import edu.harvard.iq.dataverse.api.AbstractApiBean;
85
import edu.harvard.iq.dataverse.authorization.AuthenticationServiceBean;
@@ -6251,6 +6248,7 @@ public void setFileMetadataForAction(FileMetadata fileMetadataForAction) {
62516248

62526249
private String termsOfAccess;
62536250
private boolean fileAccessRequest;
6251+
private boolean publishDisclaimerAcknowledged;
62546252

62556253
public String getTermsOfAccess() {
62566254
return termsOfAccess;
@@ -6268,6 +6266,14 @@ public void setFileAccessRequest(boolean fileAccessRequest) {
62686266
this.fileAccessRequest = fileAccessRequest;
62696267
}
62706268

6269+
public boolean isPublishDisclaimerAcknowledged() {
6270+
return publishDisclaimerAcknowledged || !settingsWrapper.isHasPublishDatasetDisclaimerText();
6271+
}
6272+
6273+
public void setPublishDisclaimerAcknowledged(boolean publishDisclaimerAcknowledged) {
6274+
this.publishDisclaimerAcknowledged = publishDisclaimerAcknowledged;
6275+
}
6276+
62716277
// wrapper method to see if the file has been deleted (or replaced) in the current version
62726278
public boolean isFileDeleted (DataFile dataFile) {
62736279
if (dataFile.getDeleted() == null) {

src/main/java/edu/harvard/iq/dataverse/SettingsWrapper.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ public class SettingsWrapper implements java.io.Serializable {
124124

125125
private Boolean webloaderUpload = null;
126126

127-
private String metricsUrl = null;
127+
private String metricsUrl = null;
128+
129+
private String publishDatasetDisclaimerText = null;
128130

129131
private Boolean dataFilePIDSequentialDependent = null;
130132

@@ -872,4 +874,15 @@ public List<MetadataBlock> getSystemMetadataBlocks() {
872874

873875
return systemMetadataBlocks;
874876
}
875-
}
877+
878+
public String getPublishDatasetDisclaimerText() {
879+
if (publishDatasetDisclaimerText == null) {
880+
publishDatasetDisclaimerText = getValueForKey(Key.PublishDatasetDisclaimerText);
881+
}
882+
return publishDatasetDisclaimerText;
883+
}
884+
885+
public Boolean isHasPublishDatasetDisclaimerText() {
886+
return !StringUtil.isEmpty(getPublishDatasetDisclaimerText());
887+
}
888+
}

src/main/java/edu/harvard/iq/dataverse/api/Info.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ public Response getDatasetPublishPopupCustomText() {
4646
return getSettingResponseByKey(SettingsServiceBean.Key.DatasetPublishPopupCustomText);
4747
}
4848

49+
@GET
50+
@Path("settings/:PublishDatasetDisclaimerText")
51+
public Response getPublishDatasetDisclaimerText() {
52+
return getSettingResponseByKey(SettingsServiceBean.Key.PublishDatasetDisclaimerText);
53+
}
54+
4955
@GET
5056
@Path("settings/:MaxEmbargoDurationInMonths")
5157
public Response getMaxEmbargoDurationInMonths() {

src/main/java/edu/harvard/iq/dataverse/settings/SettingsServiceBean.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,10 @@ <p>Size limit (in bytes) for tabular file ingest. Accepts either a single numeri
326326
*/
327327
DatasetPublishPopupCustomTextOnAllVersions,
328328
/*
329+
Publish Disclaimer text. If this setting exists user must acknowledge before a Dataset can be published
330+
*/
331+
PublishDatasetDisclaimerText,
332+
/*
329333
Whether Harvesting (OAI) service is enabled
330334
*/
331335
OAIServerEnabled,

src/main/webapp/dataset.xhtml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,8 +2030,18 @@
20302030
<p class="col-sm-12 help-block">#{bundle['dataset.publish.terms.help.tip']}</p>
20312031
</div>
20322032
</ui:fragment>
2033+
<ui:fragment rendered="#{valid and settingsWrapper.isHasPublishDatasetDisclaimerText()}">
2034+
<div class="form-group">
2035+
<p:selectBooleanCheckbox class="text-danger" id="publishDisclaimer"
2036+
itemLabel="#{settingsWrapper.getPublishDatasetDisclaimerText()}"
2037+
value="#{DatasetPage.publishDisclaimerAcknowledged}">
2038+
<p:ajax event="change" update="releaseDatasetButton"/>
2039+
</p:selectBooleanCheckbox>
2040+
</div>
2041+
</ui:fragment>
20332042
<div class="button-block">
2034-
<p:commandButton rendered="#{valid}" styleClass="btn btn-default" value="#{bundle.continue}"
2043+
<p:commandButton id="releaseDatasetButton" rendered="#{valid}" styleClass="btn btn-default" value="#{bundle.continue}"
2044+
disabled="#{!DatasetPage.publishDisclaimerAcknowledged}"
20352045
onclick="PF('publishDataset').hide();
20362046
PF('blockDatasetForm').hide();" action="#{DatasetPage.releaseDataset}" />
20372047
<button class="btn btn-link" onclick="PF('publishDataset').hide();
@@ -2086,7 +2096,7 @@
20862096
<p class="text-warning">
20872097
<span class="glyphicon glyphicon-warning-sign"/> #{bundle['dataset.rejectMessage']} #{disableReasonField ? '':bundle['dataset.rejectMessageReason']}
20882098
</p>
2089-
2099+
20902100
<ui:fragment rendered="#{!disableReasonField}">
20912101
<p:inputTextarea id="returnReason" rows="4" value="#{DatasetPage.returnReason}" title="#{bundle['dataset.rejectMessage.label']}" maxlength="2000" widgetVar="returnReason"
20922102
cols="70" counter="display" counterTemplate="{0} characters remaining." autoResize="false"
@@ -2098,7 +2108,7 @@
20982108
<p:watermark for="returnReason" value="#{bundle['dataset.rejectWatermark']}" id="returnReasonWatermark"/>
20992109
<h:message for="returnReason" styleClass="bg-danger text-danger"/>
21002110
</ui:fragment>
2101-
2111+
21022112
<div class="button-block">
21032113
<p:commandButton styleClass="btn btn-default" value="#{bundle.continue}"
21042114
update="@form"
@@ -2183,7 +2193,7 @@
21832193
<script>
21842194
Cite.CSL.register.addTemplate("#{requestedCSL}",
21852195
"#{CSLUtil:getCitationFormat((requestedCSL == '') ? 'apa' : requestedCSL)}");
2186-
2196+
21872197
document.getElementById('datasetForm:cslOutput').innerHTML = cite.format("bibliography", {
21882198
format: "html",
21892199
template: "#{requestedCSL}",

src/test/java/edu/harvard/iq/dataverse/api/InfoIT.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,24 @@ public static void setUpClass() {
2525
UtilIT.deleteSetting(SettingsServiceBean.Key.DatasetPublishPopupCustomText);
2626
UtilIT.deleteSetting(SettingsServiceBean.Key.ApplicationTermsOfUse);
2727
UtilIT.deleteSetting(SettingsServiceBean.Key.ApplicationTermsOfUse, "fr");
28+
UtilIT.deleteSetting(SettingsServiceBean.Key.PublishDatasetDisclaimerText);
2829
}
2930

3031
@AfterAll
3132
public static void afterClass() {
3233
UtilIT.deleteSetting(SettingsServiceBean.Key.MaxEmbargoDurationInMonths);
3334
UtilIT.deleteSetting(SettingsServiceBean.Key.DatasetPublishPopupCustomText);
35+
UtilIT.deleteSetting(SettingsServiceBean.Key.PublishDatasetDisclaimerText);
3436
}
3537

3638
@Test
3739
public void testGetDatasetPublishPopupCustomText() {
3840
testSettingEndpoint(SettingsServiceBean.Key.DatasetPublishPopupCustomText, "Hello world!");
3941
}
42+
@Test
43+
public void testGetDatasetPublishDisclaimerText() {
44+
testSettingEndpoint(SettingsServiceBean.Key.PublishDatasetDisclaimerText, "Hello world!");
45+
}
4046

4147
@Test
4248
public void testGetMaxEmbargoDurationInMonths() {

0 commit comments

Comments
 (0)