-
Notifications
You must be signed in to change notification settings - Fork 493
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
8191 require toa or req access #8308
Merged
Merged
Changes from 13 commits
Commits
Show all changes
98 commits
Select commit
Hold shift + click to select a range
7ffa9e9
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 811422e
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 12fba42
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller a849d6c
#8191 update ui and bundle, etc.
sekmiller a6785b7
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 0778ca8
#8191 disable save on Terms when invalid
sekmiller a952c95
#8191 only validate terms if restricted files are present
sekmiller b206e02
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 316ac05
#8191 redirect to TOA if invalid
sekmiller dc03b62
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 28d8ba5
#8191 disable Publish if invalid TOA/RA
sekmiller 2b0e7e5
#8191 fix help for popup/edit terms
sekmiller 622416d
#8191 ui update
sekmiller b748694
#8191 stray ;
sekmiller f9fc435
#8191 remove debut code
sekmiller 90141b3
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 839cf1f
adding release note file
djbrooke 71e9847
release note text
djbrooke 74a4e3a
add query to find datasets and owners to contact
djbrooke bfb0979
note linking to query
djbrooke 733bca2
one more update to the release note
djbrooke cf4f799
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 8026778
#8191 fix tests and update query
sekmiller 2a59521
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 47945fa
#8191 move validation message to Bundle
sekmiller c826517
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 8fd45e4
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller a20fbd5
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 37a8630
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 021fde6
#8191 code cleanup fix file page
sekmiller b7cef02
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller f64cfd0
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 4c799e3
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 64a40ea
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 70ea695
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 5a07521
#8191 remove duplicate popup
sekmiller 318d490
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller f5e2cfe
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 1f949f3
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 70363aa
#8191 update terms page
sekmiller 1d3dade
#8191 update from dev
sekmiller bf7b218
#8191 remove debug line
sekmiller eb402aa
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller a7875ce
#8191 remove out of date comment/code
sekmiller e260f50
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 5f015bf
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller a84a5d7
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 019b42a
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 7279c80
#8191 consolidate delete function
sekmiller 56084a6
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller f4c8172
#8191 delete duplicate popup
sekmiller 29e0dc4
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 247fda1
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 76c7c70
#8191 fix edit metadata popup
sekmiller c124642
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 22fde43
#8191 hide block ds on cancel
sekmiller 9b782a7
#8191 add validate or die to commands
sekmiller e8be115
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 5781394
#8191 add integration test for req/toa validation
sekmiller 8da1b43
#8191 fix default values disable edits
sekmiller 157dc2c
#8191 disable files buttons
sekmiller 4ad680b
#8191 test edit version for valid toua
sekmiller c904902
#8191 disable metadata tab edit
sekmiller f479b1e
#8191 add more info to popup terms page
sekmiller 3a84f83
#8191 update render on terms help
sekmiller 02ad3c9
#8191 format terms of access help text
sekmiller a03a42d
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 595d8c9
#8191 fix link to guides
sekmiller db3e27f
#8191 fix label and close tabs by default
sekmiller a162ede
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller bfe03bf
#8191 add TOUA validation messages
sekmiller 6ee5313
#8191 ui changes requested
sekmiller c3d5ce0
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 77870cc
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 6988cc7
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 41a00bc
Update dataset-license-terms.xhtml
sekmiller 6c9d0ed
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 8ce5c88
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller ab57f63
#8191 remove unused dialogs
sekmiller 869b6ce
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 98795f1
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller f2a24d5
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 3079af5
#8191 add warning for TOA out of compliance
sekmiller cbbeed1
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller f19e521
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller e4c1c3b
#8191 prelim ui updates
sekmiller 28f7c6e
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 2b3c8b7
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 231a15f
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller b7c9997
#8191 update popup validation
sekmiller cd068f6
#8191 fix for filepage and terms
sekmiller 18c13c1
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 0188084
#8191 resolve merge
sekmiller d1fa0ce
#8191 fix create ds
sekmiller ebec3bd
#8191 fix success message posting
sekmiller e46f614
#8191 fix add terms to Sword DB
sekmiller 040a46f
Merge branch 'develop' into 8191-require-TOA-or-req-access
sekmiller 3eb6f4b
#8191 fix save buttons
sekmiller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 == null || this.fileMetadatas.isEmpty()){ | ||
return false; | ||
} | ||
return this.fileMetadatas.stream().anyMatch(fm -> (fm.isRestricted())); | ||
} | ||
|
||
public void updateDefaultValuesFromTemplate(Template template) { | ||
if (!template.getDatasetFields().isEmpty()) { | ||
|
@@ -591,15 +598,12 @@ public DatasetVersion cloneDatasetVersion(){ | |
dsv.setDatasetFields(dsv.copyDatasetFields(this.getDatasetFields())); | ||
} | ||
|
||
if (this.getTermsOfUseAndAccess()!= null){ | ||
dsv.setTermsOfUseAndAccess(this.getTermsOfUseAndAccess().copyTermsOfUseAndAccess()); | ||
} else { | ||
TermsOfUseAndAccess terms = new TermsOfUseAndAccess(); | ||
terms.setDatasetVersion(dsv); | ||
terms.setLicense(TermsOfUseAndAccess.License.CC0); | ||
dsv.setTermsOfUseAndAccess(terms); | ||
} | ||
|
||
/* | ||
adding file metadatas here and updating terms | ||
because the terms need to know about the files | ||
in a pre-save validation SEK 12/6/2021 | ||
*/ | ||
|
||
for (FileMetadata fm : this.getFileMetadatas()) { | ||
FileMetadata newFm = new FileMetadata(); | ||
// TODO: | ||
|
@@ -619,9 +623,17 @@ public DatasetVersion cloneDatasetVersion(){ | |
|
||
dsv.getFileMetadatas().add(newFm); | ||
} | ||
|
||
|
||
|
||
|
||
if (this.getTermsOfUseAndAccess()!= null){ | ||
TermsOfUseAndAccess terms = this.getTermsOfUseAndAccess().copyTermsOfUseAndAccess(); | ||
terms.setDatasetVersion(dsv); | ||
dsv.setTermsOfUseAndAccess(terms); | ||
} else { | ||
TermsOfUseAndAccess terms = new TermsOfUseAndAccess(); | ||
terms.setDatasetVersion(dsv); | ||
terms.setLicense(TermsOfUseAndAccess.License.CC0); | ||
dsv.setTermsOfUseAndAccess(terms); | ||
} | ||
|
||
dsv.setDataset(this.getDataset()); | ||
return dsv; | ||
|
@@ -636,6 +648,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 +1682,23 @@ public Set<ConstraintViolation> 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<ConstraintViolation<TermsOfUseAndAccess>> constraintViolations = validator.validate(toua); | ||
if (constraintViolations.size() > 0) { | ||
ConstraintViolation<TermsOfUseAndAccess> 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."; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this English text go in Bundle.properties? |
||
logger.info(message); | ||
this.termsOfUseAndAccess.setValidationMessage(message); | ||
returnSet.add(violation); | ||
} | ||
} | ||
|
||
|
||
return returnSet; | ||
} | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It seems like the new validator is only called from the GUI? Are the same rules enforced via API?
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.
As I mentioned before we all left for break, the validator is called by the commands via the validateOrDie method so it will be applied to all dataset versions created or updated using the various apis.