From a849d6cb4a037f971075ff6838bbe3023ed4d953 Mon Sep 17 00:00:00 2001
From: Stephen Kraffmiller
Date: Tue, 30 Nov 2021 09:44:41 -0500
Subject: [PATCH 01/49] #8191 update ui and bundle, etc.
---
.../edu/harvard/iq/dataverse/Dataset.java | 1 +
.../edu/harvard/iq/dataverse/DatasetPage.java | 15 +++++-
.../harvard/iq/dataverse/DatasetVersion.java | 28 +++++++++++
.../edu/harvard/iq/dataverse/Template.java | 1 +
.../iq/dataverse/TermsOfUseAndAccess.java | 13 ++++++
.../TermsOfUseAndAccessValidator.java | 46 ++++++++++++++++---
src/main/java/propertyFiles/Bundle.properties | 4 +-
src/main/webapp/dataset-license-terms.xhtml | 36 ++++++++++-----
src/main/webapp/editFilesFragment.xhtml | 45 +++++++++++-------
.../webapp/file-edit-popup-fragment.xhtml | 19 ++++++--
10 files changed, 166 insertions(+), 42 deletions(-)
diff --git a/src/main/java/edu/harvard/iq/dataverse/Dataset.java b/src/main/java/edu/harvard/iq/dataverse/Dataset.java
index 60466f96362..f1fe7b2b09d 100644
--- a/src/main/java/edu/harvard/iq/dataverse/Dataset.java
+++ b/src/main/java/edu/harvard/iq/dataverse/Dataset.java
@@ -319,6 +319,7 @@ private DatasetVersion createNewDatasetVersion(Template template, FileMetadata f
TermsOfUseAndAccess terms = new TermsOfUseAndAccess();
terms.setDatasetVersion(dsv);
terms.setLicense(TermsOfUseAndAccess.License.CC0);
+ terms.setFileAccessRequest(true);
dsv.setTermsOfUseAndAccess(terms);
}
diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
index 90ca5ecb027..0367fca8591 100644
--- a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
+++ b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
@@ -394,6 +394,18 @@ public void setRsyncScript(String rsyncScript) {
public String getRsyncScriptFilename() {
return rsyncScriptFilename;
}
+
+ private Boolean hasRestrictedFiles = null;
+
+ public Boolean isHasRestrictedFiles(){
+ //cache in page to limit processing
+ if (hasRestrictedFiles != null){
+ return hasRestrictedFiles;
+ } else {
+ hasRestrictedFiles = workingVersion.isHasRestrictedFile();
+ return hasRestrictedFiles;
+ }
+ }
private String thumbnailString = null;
@@ -2054,7 +2066,8 @@ private String init(boolean initFull) {
previewTools = externalToolService.findFileToolsByType(ExternalTool.Type.PREVIEW);
datasetExploreTools = externalToolService.findDatasetToolsByType(ExternalTool.Type.EXPLORE);
rowsPerPage = 10;
-
+ hasRestrictedFiles = workingVersion.isHasRestrictedFile();
+
return null;
}
diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetVersion.java b/src/main/java/edu/harvard/iq/dataverse/DatasetVersion.java
index d53cf20491c..2a235e5fefb 100644
--- a/src/main/java/edu/harvard/iq/dataverse/DatasetVersion.java
+++ b/src/main/java/edu/harvard/iq/dataverse/DatasetVersion.java
@@ -560,6 +560,13 @@ public boolean isHasNonPackageFile(){
// The presence of any non-package file means that HTTP Upload was used (no mixing allowed) so we just check the first file.
return !this.fileMetadatas.get(0).getDataFile().getContentType().equals(DataFileServiceBean.MIME_TYPE_PACKAGE_FILE);
}
+
+ public boolean isHasRestrictedFile(){
+ if (this.fileMetadatas.isEmpty()){;
+ return false;
+ }
+ return this.fileMetadatas.stream().anyMatch(fm -> (fm.isRestricted()));
+ }
public void updateDefaultValuesFromTemplate(Template template) {
if (!template.getDatasetFields().isEmpty()) {
@@ -636,6 +643,11 @@ public void initDefaultValues() {
TermsOfUseAndAccess terms = new TermsOfUseAndAccess();
terms.setDatasetVersion(this);
terms.setLicense(TermsOfUseAndAccess.License.CC0);
+ /*
+ Added for https://github.com/IQSS/dataverse/issues/8191
+ set File Access Request to true
+ */
+ terms.setFileAccessRequest(true);
this.setTermsOfUseAndAccess(terms);
}
@@ -1665,7 +1677,23 @@ public Set validate() {
}
}
}
+
+
+ TermsOfUseAndAccess toua = this.termsOfUseAndAccess;
+ //Only need to test Terms of Use and Access if there are restricted files
+ if (toua != null && this.isHasRestrictedFile()) {
+ Set> constraintViolations = validator.validate(toua);
+ if (constraintViolations.size() > 0) {
+ ConstraintViolation violation = constraintViolations.iterator().next();
+ String message = "Constraint violation found in Terms of Use and Access. "
+ + "If Request Access to restricted files is disabled then Terms of Access must be provided.";
+ logger.info(message);
+ this.termsOfUseAndAccess.setValidationMessage(message);
+ returnSet.add(violation);
+ }
+ }
+
return returnSet;
}
diff --git a/src/main/java/edu/harvard/iq/dataverse/Template.java b/src/main/java/edu/harvard/iq/dataverse/Template.java
index b01b0a2b792..5b9d7c82fe8 100644
--- a/src/main/java/edu/harvard/iq/dataverse/Template.java
+++ b/src/main/java/edu/harvard/iq/dataverse/Template.java
@@ -326,6 +326,7 @@ public Template cloneNewTemplate(Template source) {
} else {
terms = new TermsOfUseAndAccess();
terms.setLicense(TermsOfUseAndAccess.defaultLicense);
+ terms.setFileAccessRequest(true);
}
newTemplate.setTermsOfUseAndAccess(terms);
return newTemplate;
diff --git a/src/main/java/edu/harvard/iq/dataverse/TermsOfUseAndAccess.java b/src/main/java/edu/harvard/iq/dataverse/TermsOfUseAndAccess.java
index 72f4ab54ee8..04dd48ea473 100644
--- a/src/main/java/edu/harvard/iq/dataverse/TermsOfUseAndAccess.java
+++ b/src/main/java/edu/harvard/iq/dataverse/TermsOfUseAndAccess.java
@@ -14,6 +14,7 @@
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
+import javax.persistence.Transient;
/**
*
@@ -21,6 +22,7 @@
* @author skraffmi
*/
@Entity
+@ValidateTermsOfUseAndAccess
public class TermsOfUseAndAccess implements Serializable {
@Id
@@ -275,6 +277,17 @@ public enum License {
NONE, CC0
}
+ @Transient
+ private String validationMessage;
+
+ public String getValidationMessage() {
+ return validationMessage;
+ }
+
+ public void setValidationMessage(String validationMessage) {
+ this.validationMessage = validationMessage;
+ }
+
/**
* @todo What does the GUI use for a default license? What does the "native"
* API use? See also https://github.com/IQSS/dataverse/issues/1385
diff --git a/src/main/java/edu/harvard/iq/dataverse/TermsOfUseAndAccessValidator.java b/src/main/java/edu/harvard/iq/dataverse/TermsOfUseAndAccessValidator.java
index dfa9e9f6c77..394d0f359ac 100644
--- a/src/main/java/edu/harvard/iq/dataverse/TermsOfUseAndAccessValidator.java
+++ b/src/main/java/edu/harvard/iq/dataverse/TermsOfUseAndAccessValidator.java
@@ -21,12 +21,46 @@ public void initialize(ValidateTermsOfUseAndAccess constraintAnnotation) {
@Override
public boolean isValid(TermsOfUseAndAccess value, ConstraintValidatorContext context) {
- //if both null invalid
- //if(value.getTemplate() == null && value.getDatasetVersion() == null) return false;
+ //must allow access requests or have terms of access filled in.
- //if both not null invalid
- //return !(value.getTemplate() != null && value.getDatasetVersion() != null);
- return true;
+ boolean valid = value.isFileAccessRequest() == true || (value.getTermsOfAccess() != null && !value.getTermsOfAccess().isEmpty()) ;
+ if (!valid) {
+ try {
+
+
+ if ( context != null) {
+ context.buildConstraintViolationWithTemplate( "If Request Access is false then Terms of Access must be provided.").addConstraintViolation();
+ }
+
+ String message = "Constraint violation found in Terms of Use and Access. "
+ + " If Request Access to restricted files is set to false then Terms of Access must be provided.";
+
+ value.setValidationMessage(message);
+ } catch (NullPointerException e) {
+ return false;
+ }
+ return false;
+ }
+
+
+ return valid;
+ }
+
+ public static boolean isTOUAValid(TermsOfUseAndAccess value, ConstraintValidatorContext context){
+
+ boolean valid = value.isFileAccessRequest() == true || (value.getTermsOfAccess() != null && !value.getTermsOfAccess().isEmpty());
+ if (!valid) {
+
+ if (context != null) {
+ context.buildConstraintViolationWithTemplate("If Request Access is false then Terms of Access must be provided.").addConstraintViolation();
+ }
+
+ String message = "Constraint violation found in Terms of Use and Access. "
+ + " If Request Access to restricted files is set to false then Terms of Access must be provided.";
+
+ value.setValidationMessage(message);
+ }
+ return valid;
}
-
+
}
diff --git a/src/main/java/propertyFiles/Bundle.properties b/src/main/java/propertyFiles/Bundle.properties
index fbbda5213ad..621b9116381 100644
--- a/src/main/java/propertyFiles/Bundle.properties
+++ b/src/main/java/propertyFiles/Bundle.properties
@@ -2124,8 +2124,8 @@ citationFrame.banner.countdownMessage.seconds=seconds
#file-edit-popup-fragment.xhtml #editFilesFragment.xhtml
dataset.access.accessHeader=Restrict Files and Add Dataset Terms of Access
-dataset.access.description=Restricting limits access to published files. You can add or edit Terms of Access for the dataset, and allow people to Request Access to restricted files.
-
+dataset.access.description=Restricting limits access to published files. Providing information about access to restricted files is required. By default people who want to use these files can request access to them. You can provide Terms of Access instead by unchecking the box and adding them. These settings can be changed when you edit the dataset. Learn about restricting files and dataset access in the User Guide.
+dataset.access.description.line.2=One of the following methods for communicating access must be active, and applies to all restricted files in this dataset.
#datasetFieldForEditFragment.xhtml
dataset.AddReplication=Add "Replication Data for" to Title
dataset.replicationDataFor=Replication Data for:
diff --git a/src/main/webapp/dataset-license-terms.xhtml b/src/main/webapp/dataset-license-terms.xhtml
index c5bdc8638cf..cf623ec8c8a 100644
--- a/src/main/webapp/dataset-license-terms.xhtml
+++ b/src/main/webapp/dataset-license-terms.xhtml
@@ -277,26 +277,38 @@
-
Date: Fri, 11 Feb 2022 17:24:15 -0500
Subject: [PATCH 21/49] #8191 remove out of date comment/code
---
.../edu/harvard/iq/dataverse/TermsOfUseAndAccess.java | 8 --------
1 file changed, 8 deletions(-)
diff --git a/src/main/java/edu/harvard/iq/dataverse/TermsOfUseAndAccess.java b/src/main/java/edu/harvard/iq/dataverse/TermsOfUseAndAccess.java
index c4f52d7ffca..a8616283332 100644
--- a/src/main/java/edu/harvard/iq/dataverse/TermsOfUseAndAccess.java
+++ b/src/main/java/edu/harvard/iq/dataverse/TermsOfUseAndAccess.java
@@ -300,14 +300,6 @@ public void setValidationMessage(String validationMessage) {
this.validationMessage = validationMessage;
}
- /**
- * @todo What does the GUI use for a default license? What does the "native"
- * API use? See also https://github.com/IQSS/dataverse/issues/1385
- */
- /*
- public static TermsOfUseAndAccess.License defaultLicense = TermsOfUseAndAccess.License.CC0;
- public static String CC0_URI = "https://creativecommons.org/publicdomain/zero/1.0/";
- */
@Override
public int hashCode() {
int hash = 0;
From 7279c800fab3745634a3f1b4c01ec5094574c9f5 Mon Sep 17 00:00:00 2001
From: Stephen Kraffmiller
Date: Wed, 23 Feb 2022 11:07:53 -0500
Subject: [PATCH 22/49] #8191 consolidate delete function
---
.../edu/harvard/iq/dataverse/DatasetPage.java | 44 +++++++------------
src/main/webapp/editFilesFragment.xhtml | 6 ++-
2 files changed, 21 insertions(+), 29 deletions(-)
diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
index 80917d58a1c..cb0539738c6 100644
--- a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
+++ b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
@@ -143,6 +143,7 @@
import edu.harvard.iq.dataverse.search.SearchServiceBean;
import edu.harvard.iq.dataverse.search.SearchUtil;
import edu.harvard.iq.dataverse.search.SolrClientService;
+import edu.harvard.iq.dataverse.util.FileMetadataUtil;
import java.util.Comparator;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
@@ -3374,7 +3375,16 @@ public String deleteFiles() throws CommandException{
}
deleteFiles(filesToDelete);
- String retVal = save();
+ String retVal;
+
+ if (editMode == EditMode.CREATE) {
+ workingVersion.setFileMetadatas(new ArrayList<>());
+ retVal = "";
+ } else {
+ retVal = save();
+ }
+
+
//And delete them only after the dataset is updated
for(Embargo emb: orphanedEmbargoes) {
embargoService.deleteById(emb.getId(), ((AuthenticatedUser)session.getUser()).getUserIdentifier());
@@ -3409,32 +3419,12 @@ private void deleteFiles(List filesToDelete) {
// So below we are deleting the metadata from the version; we are
// NOT adding the file to the filesToBeDeleted list that will be
// passed to the UpdateDatasetCommand. -- L.A. Aug 2017
- Iterator fmit = dataset.getEditVersion().getFileMetadatas().iterator();
- while (fmit.hasNext()) {
- FileMetadata fmd = fmit.next();
- if (markedForDelete.getDataFile().getStorageIdentifier().equals(fmd.getDataFile().getStorageIdentifier())) {
- // And if this is an image file that happens to be assigned
- // as the dataset thumbnail, let's null the assignment here:
-
- if (fmd.getDataFile().equals(dataset.getThumbnailFile())) {
- dataset.setThumbnailFile(null);
- }
- /* It should not be possible to get here if this file
- is not in fact released! - so the code block below
- is not needed.
- //if not published then delete identifier
- if (!fmd.getDataFile().isReleased()){
- try{
- commandEngine.submit(new DeleteDataFileCommand(fmd.getDataFile(), dvRequestService.getDataverseRequest()));
- } catch (CommandException e){
- //this command is here to delete the identifier of unreleased files
- //if it fails then a reserved identifier may still be present on the remote provider
- }
- } */
- fmit.remove();
- break;
- }
- }
+
+ FileMetadataUtil.removeFileMetadataFromList(workingVersion.getFileMetadatas(), markedForDelete);
+
+ FileMetadataUtil.removeDataFileFromList(newFiles, markedForDelete.getDataFile());
+ FileUtil.deleteTempFile(markedForDelete.getDataFile(), dataset, ingestService);
+
}
}
diff --git a/src/main/webapp/editFilesFragment.xhtml b/src/main/webapp/editFilesFragment.xhtml
index 6558bb47b38..f6b5157a1a5 100644
--- a/src/main/webapp/editFilesFragment.xhtml
+++ b/src/main/webapp/editFilesFragment.xhtml
@@ -434,8 +434,10 @@
@@ -854,7 +854,7 @@
and (empty DatasetPage.editMode or DatasetPage.editMode == 'METADATA')}">
User Guide.
+
file.dataFilesTab.terms.list.termsOfAccess.restrictedFiles=Restricted Files
file.dataFilesTab.terms.list.termsOfAccess.restrictedFiles.title=The number of restricted files in this dataset.
file.dataFilesTab.terms.list.termsOfAccess.restrictedFiles.txt=There {0, choice, 0#are|1#is|2#are} {0} restricted {0, choice, 0#files|1#file|2#files} in this dataset.
@@ -2149,6 +2152,7 @@ dataset.access.accessHeader=Restrict Files and Add Dataset Terms of Access
dataset.access.accessHeader.invalid.state=Define Data Access
dataset.access.description=Restricting limits access to published files. People who want to use the restricted files can request access by default. If you disable request access, you must add information about access to the Terms of Access field.
dataset.access.description.line.2=These settings can be changed when you edit the dataset. Learn about restricting files and dataset access in the User Guide.
+
#datasetFieldForEditFragment.xhtml
dataset.AddReplication=Add "Replication Data for" to Title
dataset.replicationDataFor=Replication Data for:
diff --git a/src/main/webapp/dataset-license-terms.xhtml b/src/main/webapp/dataset-license-terms.xhtml
index 66e6bc3ab6d..6741d0692d1 100644
--- a/src/main/webapp/dataset-license-terms.xhtml
+++ b/src/main/webapp/dataset-license-terms.xhtml
@@ -293,7 +293,16 @@
-
+
+
From 3a84f83775b5db5ebd8b0cfc64138296ef3c0792 Mon Sep 17 00:00:00 2001
From: Stephen Kraffmiller
Date: Fri, 11 Mar 2022 11:03:13 -0500
Subject: [PATCH 33/49] #8191 update render on terms help
---
src/main/webapp/dataset-license-terms.xhtml | 22 +++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/main/webapp/dataset-license-terms.xhtml b/src/main/webapp/dataset-license-terms.xhtml
index 6741d0692d1..4ca74fd2f2d 100644
--- a/src/main/webapp/dataset-license-terms.xhtml
+++ b/src/main/webapp/dataset-license-terms.xhtml
@@ -293,16 +293,18 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
#{bundle['file.dataFilesTab.terms.list.termsOfAccess.requestAccess']}
Date: Fri, 11 Mar 2022 14:32:03 -0500
Subject: [PATCH 34/49] #8191 format terms of access help text
---
src/main/webapp/dataset-license-terms.xhtml | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/main/webapp/dataset-license-terms.xhtml b/src/main/webapp/dataset-license-terms.xhtml
index 4ca74fd2f2d..03d7f9b3f66 100644
--- a/src/main/webapp/dataset-license-terms.xhtml
+++ b/src/main/webapp/dataset-license-terms.xhtml
@@ -294,15 +294,28 @@
-
+
+
+
-
+
+
+
+
+
+ #{bundle['messages.info']} –
+
+
+
+
+
+
From 595d8c956681d40ddd5d6a9e38853591b3e50703 Mon Sep 17 00:00:00 2001
From: Stephen Kraffmiller
Date: Mon, 14 Mar 2022 13:38:00 -0400
Subject: [PATCH 35/49] #8191 fix link to guides
---
src/main/java/propertyFiles/Bundle.properties | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/propertyFiles/Bundle.properties b/src/main/java/propertyFiles/Bundle.properties
index 85713ef6320..3536ef292ca 100644
--- a/src/main/java/propertyFiles/Bundle.properties
+++ b/src/main/java/propertyFiles/Bundle.properties
@@ -1776,7 +1776,7 @@ file.dataFilesTab.terms.list.termsOfUse.addInfo.disclaimer=Disclaimer
file.dataFilesTab.terms.list.termsOfUse.addInfo.disclaimer.title=Information regarding responsibility for uses of the Dataset.
file.dataFilesTab.terms.list.termsOfAccess.header=Additional Access Information
file.dataFilesTab.terms.list.termsOfAccess.description=Restricting limits access to published files. People who want to use the restricted files can request access by default. If you disable request access, you must add information about access to the Terms of Access field.
-file.dataFilesTab.terms.list.termsOfAccess.description.line.2=Learn about restricting files and dataset access in the User Guide.
+file.dataFilesTab.terms.list.termsOfAccess.description.line.2=Learn about restricting files and dataset access in the User Guide.
file.dataFilesTab.terms.list.termsOfAccess.restrictedFiles=Restricted Files
file.dataFilesTab.terms.list.termsOfAccess.restrictedFiles.title=The number of restricted files in this dataset.
@@ -2151,7 +2151,7 @@ citationFrame.banner.countdownMessage.seconds=seconds
dataset.access.accessHeader=Restrict Files and Add Dataset Terms of Access
dataset.access.accessHeader.invalid.state=Define Data Access
dataset.access.description=Restricting limits access to published files. People who want to use the restricted files can request access by default. If you disable request access, you must add information about access to the Terms of Access field.
-dataset.access.description.line.2=These settings can be changed when you edit the dataset. Learn about restricting files and dataset access in the User Guide.
+dataset.access.description.line.2=These settings can be changed when you edit the dataset. Learn about restricting files and dataset access in the User Guide.
#datasetFieldForEditFragment.xhtml
dataset.AddReplication=Add "Replication Data for" to Title
From db3e27f53aae6d3f1b79f84057c23a93745d00a9 Mon Sep 17 00:00:00 2001
From: Stephen Kraffmiller
Date: Mon, 14 Mar 2022 13:55:31 -0400
Subject: [PATCH 36/49] #8191 fix label and close tabs by default
---
src/main/java/propertyFiles/Bundle.properties | 2 +-
src/main/webapp/dataset-license-terms.xhtml | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/java/propertyFiles/Bundle.properties b/src/main/java/propertyFiles/Bundle.properties
index 3536ef292ca..a8bc849b200 100644
--- a/src/main/java/propertyFiles/Bundle.properties
+++ b/src/main/java/propertyFiles/Bundle.properties
@@ -1774,7 +1774,7 @@ file.dataFilesTab.terms.list.termsOfUse.addInfo.conditions=Conditions
file.dataFilesTab.terms.list.termsOfUse.addInfo.conditions.title=Any additional information that will assist the user in understanding the access and use conditions of the Dataset.
file.dataFilesTab.terms.list.termsOfUse.addInfo.disclaimer=Disclaimer
file.dataFilesTab.terms.list.termsOfUse.addInfo.disclaimer.title=Information regarding responsibility for uses of the Dataset.
-file.dataFilesTab.terms.list.termsOfAccess.header=Additional Access Information
+file.dataFilesTab.terms.list.termsOfAccess.header=Restricted Files + Terms of Access
file.dataFilesTab.terms.list.termsOfAccess.description=Restricting limits access to published files. People who want to use the restricted files can request access by default. If you disable request access, you must add information about access to the Terms of Access field.
file.dataFilesTab.terms.list.termsOfAccess.description.line.2=Learn about restricting files and dataset access in the User Guide.
diff --git a/src/main/webapp/dataset-license-terms.xhtml b/src/main/webapp/dataset-license-terms.xhtml
index 03d7f9b3f66..e7260b9f9f1 100644
--- a/src/main/webapp/dataset-license-terms.xhtml
+++ b/src/main/webapp/dataset-license-terms.xhtml
@@ -245,7 +245,7 @@
From 3079af5ce43a4e67d8e25b32e8326e5b29fd17a4 Mon Sep 17 00:00:00 2001
From: Stephen Kraffmiller
Date: Wed, 6 Apr 2022 15:01:06 -0400
Subject: [PATCH 41/49] #8191 add warning for TOA out of compliance
---
src/main/java/propertyFiles/Bundle.properties | 1 +
src/main/webapp/dataset-license-terms.xhtml | 7 ++++++-
src/main/webapp/file-edit-popup-fragment.xhtml | 9 ++++++---
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/main/java/propertyFiles/Bundle.properties b/src/main/java/propertyFiles/Bundle.properties
index 097d01a895c..f19fa0a9b21 100644
--- a/src/main/java/propertyFiles/Bundle.properties
+++ b/src/main/java/propertyFiles/Bundle.properties
@@ -1788,6 +1788,7 @@ file.dataFilesTab.terms.list.termsOfAccess.requestAccess=Request Access
file.dataFilesTab.terms.list.termsOfAccess.requestAccess.title=If checked, users can request access to the restricted files in this dataset.
file.dataFilesTab.terms.list.termsOfAccess.requestAccess.request=Users may request access to files.
file.dataFilesTab.terms.list.termsOfAccess.requestAccess.notRequest=Users may not request access to files.
+file.dataFilesTab.terms.list.termsOfAccess.requestAccess.warning.outofcompliance=You must enable request access or add terms of access to restrict file access.
file.dataFilesTab.terms.list.termsOfAccess.embargoed=Files are unavailable during the specified embargo.
file.dataFilesTab.terms.list.termsOfAccess.embargoedthenrestricted=Files are unavailable during the specified embargo and restricted after that.
file.dataFilesTab.terms.list.termsOfAccess.requestAccess.enableBtn=Enable access request
diff --git a/src/main/webapp/dataset-license-terms.xhtml b/src/main/webapp/dataset-license-terms.xhtml
index a3bf646c712..2800917dffe 100644
--- a/src/main/webapp/dataset-license-terms.xhtml
+++ b/src/main/webapp/dataset-license-terms.xhtml
@@ -293,7 +293,6 @@
Date: Tue, 12 Apr 2022 09:58:24 -0400
Subject: [PATCH 42/49] #8191 prelim ui updates
---
.../edu/harvard/iq/dataverse/DatasetPage.java | 3 ---
src/main/java/propertyFiles/Bundle.properties | 4 +---
src/main/webapp/dataset-license-terms.xhtml | 5 ++--
src/main/webapp/dataset.xhtml | 9 ++++----
.../webapp/file-edit-popup-fragment.xhtml | 23 ++++++++++++++++---
5 files changed, 28 insertions(+), 16 deletions(-)
diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
index 864bf9a5f3f..10552a8bc68 100644
--- a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
+++ b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
@@ -2114,9 +2114,6 @@ private String init(boolean initFull) {
hasValidTermsOfAccess = isHasValidTermsOfAccess();
if (!hasValidTermsOfAccess) {
String message = BundleUtil.getStringFromBundle("dataset.message.editMetadata.invalid.TOUA.message");
- if(workingVersion.isDraft()){
- message = message + " " + BundleUtil.getStringFromBundle("dataset.message.publish.invalid.TOUA.message");
- }
JsfHelper.addWarningMessage(message);
}
}
diff --git a/src/main/java/propertyFiles/Bundle.properties b/src/main/java/propertyFiles/Bundle.properties
index f19fa0a9b21..f7e4b03103c 100644
--- a/src/main/java/propertyFiles/Bundle.properties
+++ b/src/main/java/propertyFiles/Bundle.properties
@@ -1474,9 +1474,7 @@ dataset.message.uploadFilesMultiple.message=Multiple file upload/download method
dataset.message.editMetadata.label=Edit Dataset Metadata
dataset.message.editMetadata.message=Add more metadata about this dataset to help others easily find it.
dataset.message.editMetadata.duplicateFilenames=Duplicate filenames: {0}
-dataset.message.editMetadata.invalid.TOUA.message=Datasets with restricted files are now required to have Request Access enabled or Terms of Access to help people access the data. Please complete this step.
-dataset.message.filePage.invalid.TOUA.message=Datasets with restricted files are now required to have Request Access enabled or Terms of Access to help people access the data. Please complete this step.
-dataset.message.publish.invalid.TOUA.message=Publishing this draft version is disabled until Request Access is enabled or Terms of Access are provided.
+dataset.message.editMetadata.invalid.TOUA.message=Datasets with restricted files are required to have Request Access enabled or Terms of Access to help people access the data. Please edit the dataset to confirm Request Access or provide Terms of Access to be in compliance with the policy.
dataset.message.editTerms.label=Edit Dataset Terms
dataset.message.editTerms.message=Add the terms of use for this dataset to explain how to access and use your data.
diff --git a/src/main/webapp/dataset-license-terms.xhtml b/src/main/webapp/dataset-license-terms.xhtml
index 2800917dffe..049bfbd15d0 100644
--- a/src/main/webapp/dataset-license-terms.xhtml
+++ b/src/main/webapp/dataset-license-terms.xhtml
@@ -330,9 +330,8 @@
+
+
From b7c99978f7db0d35fd344c0ac6cf3ae5514edf1e Mon Sep 17 00:00:00 2001
From: Stephen Kraffmiller
Date: Thu, 14 Apr 2022 11:17:26 -0400
Subject: [PATCH 43/49] #8191 update popup validation
---
src/main/java/propertyFiles/Bundle.properties | 9 ++++---
src/main/webapp/dataset.xhtml | 22 +++++++++++++++-
.../webapp/file-edit-popup-fragment.xhtml | 26 ++++++++-----------
3 files changed, 37 insertions(+), 20 deletions(-)
diff --git a/src/main/java/propertyFiles/Bundle.properties b/src/main/java/propertyFiles/Bundle.properties
index 95179c87d9e..31a58ae65b1 100644
--- a/src/main/java/propertyFiles/Bundle.properties
+++ b/src/main/java/propertyFiles/Bundle.properties
@@ -1780,7 +1780,7 @@ file.dataFilesTab.terms.list.termsOfAccess.description.line.2=Learn about restri
file.dataFilesTab.terms.list.termsOfAccess.restrictedFiles=Restricted Files
file.dataFilesTab.terms.list.termsOfAccess.restrictedFiles.title=The number of restricted files in this dataset.
file.dataFilesTab.terms.list.termsOfAccess.restrictedFiles.txt=There {0, choice, 0#are|1#is|2#are} {0} restricted {0, choice, 0#files|1#file|2#files} in this dataset.
-file.dataFilesTab.terms.list.termsOfAccess.termsOfsAccess=Terms of Access
+file.dataFilesTab.terms.list.termsOfAccess.termsOfsAccess=Terms of Access for Restricted Files
file.dataFilesTab.terms.list.termsOfAccess.termsOfsAccess.title=Information on how and if users can access restricted files in this Dataset
file.dataFilesTab.terms.list.termsOfAccess.requestAccess=Request Access
file.dataFilesTab.terms.list.termsOfAccess.requestAccess.title=If checked, users can request access to the restricted files in this dataset.
@@ -2148,10 +2148,11 @@ ingest.csv.nullStream=Stream can't be null.
citationFrame.banner.countdownMessage.seconds=seconds
#file-edit-popup-fragment.xhtml #editFilesFragment.xhtml
-dataset.access.accessHeader=Restrict Files and Define Data Access
+dataset.access.accessHeader=Restrict Access
dataset.access.accessHeader.invalid.state=Define Data Access
-dataset.access.description=Restricting limits access to published files. People who want to use the restricted files can request access by default. If you disable request access, you must add information about access to the Terms of Access field.
-dataset.access.description.line.2=These settings can be changed when you edit the dataset. Learn about restricting files and dataset access in the User Guide.
+dataset.access.description=Restricting limits access to published files. People who want to use the restricted files can request access by default.
+dataset.access.description.disable=If you disable request access, you must add information about access to the Terms of Access field.
+dataset.access.description.line.2=Learn about restricting files and dataset access in the User Guide.
#datasetFieldForEditFragment.xhtml
dataset.AddReplication=Add "Replication Data for" to Title
diff --git a/src/main/webapp/dataset.xhtml b/src/main/webapp/dataset.xhtml
index 774ec1b865a..ce0c1774350 100644
--- a/src/main/webapp/dataset.xhtml
+++ b/src/main/webapp/dataset.xhtml
@@ -111,6 +111,11 @@
+
+
+
+
+
@@ -1960,7 +1965,22 @@
if (outcome ==='GuestbookRequired'){
PF('downloadPopup').show();
}
- }
+ }
+
+ function testTOA() {
+
+ var termsofAccessHidden = document.getElementById("datasetForm:termsofAccessHidden").value;
+ var fileAccessRequestHidden = document.getElementById("datasetForm:fileAccessRequestHidden").value;
+
+
+
+ if (fileAccessRequestHidden === 'false' && termsofAccessHidden === '') {
+ alert('invalidTermsofAccessHidden');
+ } else {
+ PF('accessPopup').hide();
+ }
+ }
+
//]]>
diff --git a/src/main/webapp/file-edit-popup-fragment.xhtml b/src/main/webapp/file-edit-popup-fragment.xhtml
index 6a32d581e8e..ad34b09c2a1 100644
--- a/src/main/webapp/file-edit-popup-fragment.xhtml
+++ b/src/main/webapp/file-edit-popup-fragment.xhtml
@@ -32,29 +32,34 @@
@@ -857,7 +857,7 @@
rendered="#{(!DatasetPage.workingVersion.deaccessioned or (DatasetPage.workingVersion.deaccessioned and DatasetPage.canUpdateDataset()))
and (empty DatasetPage.editMode or DatasetPage.editMode == 'METADATA')}">