-
Notifications
You must be signed in to change notification settings - Fork 494
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
Support for configurable list of licenses #7920
Changes from 106 commits
bc34031
5d08b0e
f9e3a3e
5e3fb88
0394652
cb58637
dda1335
c87c367
67b7471
4b6c367
784fdb0
8a9974d
67178c9
c9d33e2
f6c99eb
878ef6f
5bb0142
855f8a0
41887c5
d3da68b
60292bb
5cee794
49f5d0a
0cf7359
245f04c
6219010
5280a50
f670d73
13ec753
0273c0f
83b21f0
71f6be2
55bd5a1
8f1969c
ec4fd30
336359d
7dbd78d
e28e4e0
832e4f6
b1fb21f
74cd21b
9ad49e8
7d5c0d1
7676ab5
8915c06
17616c4
918c86f
8cc996a
ec37254
2ecba09
58b623e
5b68e53
a980c5e
c34bd3e
6313887
5c72dca
9895ddd
1b8765e
d9e61a5
e45b74c
1a9fe2e
6516186
2497228
1e1e0f6
6840329
fab2f99
20e4360
0dc8e80
0a187ee
5b952b1
d425ec7
4c12a7e
c2e7375
fd21968
4518fd6
19f3eac
7df29a1
f8270de
6cc86e0
352e6b4
a5e0125
046df42
f93e45f
56c12c4
924e166
e499435
417b875
0dd15b0
46f675e
9223a3e
9f58548
31d7470
925a1c3
556be4a
051f75d
b001bf1
47cabe1
60cb2ea
06c8574
9192f35
6a708fc
741f255
6ad3bc3
a421aba
5151b94
896c02a
fae7475
cea9c17
e21ee3b
9840eb3
83e8dfe
1002e87
7cafa70
9cb9518
ef2e276
d2c61b3
6159d19
91a5fab
e55b12e
4cbaa01
f5ee336
a55304c
ff5fcaf
97ff410
1c4ee43
f994923
1d575bd
a79143e
b87e19a
c9bf631
150a393
1a7def0
de506ee
19f9edf
73e6fc8
1065610
727c997
76a12d1
0618c14
1f81a45
9cf8e6d
5045950
3d70aeb
525add2
a4eb99e
af8cba7
dea8f13
2be06ef
0fc0124
59c4b25
d04cfce
019dd94
2438185
e1be751
3da511a
9c15773
c8b4ef7
a213ab4
119eca8
f838f74
5a582f3
61e327e
0cfe058
529c5d0
1c50160
9a4fa8d
b6c2d80
842f0a8
4bbd51a
b1880cb
dbdc031
e83e3d7
2ed5680
3d26262
c10530c
b6d170b
513c011
2fac0e8
02a04bd
27a607f
a6687a0
663bde9
a183b4a
3e897e8
632b71d
5ef1972
dc08712
7bcfa0e
9131e96
e8c9fc9
5cf2bd4
8f2624b
1e2e83b
76a789b
1c79279
aee5d76
fb60c1f
5623537
7bdf6b6
5d1b8e1
dad5fc8
91fba7c
eeab710
0b667be
b097628
3d71fc9
a85765d
304371c
e4e9f0e
ec3965e
4175f4b
075d55b
d4ef070
fb309dd
860b08f
4433533
7a176a5
9526963
4665ac7
54bf74c
7721ca9
55f7d0d
334bb48
20b3142
667c1b0
148fbcd
fd8946c
e6d449a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "CC-BY-4.0", | ||
"uri": "http://creativecommons.org/licenses/by/4.0", | ||
"shortDescription": "Creative Commons Attribution 4.0 International License.", | ||
"iconUrl": "https://i.creativecommons.org/l/by/4.0/88x31.png", | ||
"active": true | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3576,3 +3576,28 @@ Recursively applies the role assignments of the specified Dataverse collection, | |
GET http://$SERVER/api/admin/dataverse/{dataverse alias}/addRoleAssignmentsToChildren | ||
|
||
Note: setting ``:InheritParentRoleAssignments`` will automatically trigger inheritance of the parent Dataverse collection's role assignments for a newly created Dataverse collection. Hence this API call is intended as a way to update existing child Dataverse collections or to update children after a change in role assignments has been made on a parent Dataverse collection. | ||
|
||
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. This is a geneal comment about updates to the guides. We should probably update the "Terms" section in the User Guide from what's currently there: https://guides.dataverse.org/en/5.9/user/dataset-management.html#terms 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. Good catch - will do. |
||
|
||
Manage Available Standard License Terms | ||
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. We might want to move these outside "admin" so regular API users can learn what licenses are available. 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. Makes sense - for the get licenses call anyway. Probably good if API users can directly tell if custom licenses are allowed too. Is there a precedent for a split API like that where get is open and the change/delete functionality is restricted? (Looking at how to construct the URLs and where to place the code - I know there are some /api/admin/* calls not in the Admin class, but I don't know what best practice is.) 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. Perhaps we should have a new top level That way, any API client could get a list of licenses even without authenticating. But only superusers would be able to add licenses. |
||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
View the list of standard license terms that can be selected for a dataset:: | ||
|
||
curl http://$SERVER/api/admin/licenses | ||
|
||
View the details of the standard license with the database ID specified in ``$ID``:: | ||
|
||
export ID=1 | ||
curl http://$SERVER/api/admin/licenses/$ID | ||
|
||
Add a new license by posting a JSON file adapted from this example :download:`add-license.json <../_static/api/add-license.json>`. The ``name`` and ``uri`` of the new license must be unique. :: | ||
|
||
curl -X POST -H 'Content-Type: application/json' --data-binary @add-license.json http://$SERVER/api/admin/licenses | ||
|
||
Overwrite the license with the database specified in ``$ID``:: | ||
|
||
curl -X PUT -H 'Content-Type: application/json' --data-binary @edit-license.json http://$SERVER/api/admin/licenses/$ID | ||
|
||
Delete the license with with the database specified in ``$ID``:: | ||
|
||
curl -X DELETE http://$SERVER/api/admin/licenses/$ID |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "CC-BY-4.0", | ||
"uri": "http://creativecommons.org/licenses/by/4.0", | ||
"shortDescription": "Creative Commons Attribution 4.0 International License.", | ||
"iconUrl": "https://i.creativecommons.org/l/by/4.0/88x31.png", | ||
"active": false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
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. These three are used only for tests? Maybe they should go under /src/test/resources somewhere (suggestions anyone? in the json dir with datasets or a new licenses dir?) 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. I think just adding it to the json dir in /src/test/resources with a descriptive name should be okay 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. @qqmyers on second thought the rest of the tests also use the scripts/api/data/ directory for the tests, it would make more sense to change that as a whole then for all Integration Tests? Changing the directory to /src/test/resources just for the license test wouldn't make a lot of sense I think 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. @scolapasta , @pdurbin - any guidance for where test data should go? It seems like existing test data is not all in one place, so I'm not sure what the recommendation would be for new test data. 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. Under /src/test/resources sounds fine to me. You're right. Test data is a bit spread around. But at least it'll be in good company there. 😄 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. So I think putting all the test data there makes sense too - (not sure if I commented on all the test files, but I wasn't trying to single this one out.) |
||
"id": 6, | ||
"name": "CC-BY-4.0", | ||
"uri": "http://creativecommons.org/licenses/by/4.0", | ||
"shortDescription": "Creative Commons Attribution 4.0 International License.", | ||
"iconUrl": "https://i.creativecommons.org/l/by/4.0/88x31.png", | ||
"active": true | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "CC-BY-4.0", | ||
"uri": "http://creativecommons.org/licenses/by/4.0", | ||
"shortDescription": "Creative Commons Attribution 4.0 International License.", | ||
"iconUrl": "https://i.creativecommons.org/l/by/4.0/88x31.png", | ||
"active": true | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -291,15 +291,15 @@ public void setVersions(List<DatasetVersion> versions) { | |
this.versions = versions; | ||
} | ||
|
||
private DatasetVersion createNewDatasetVersion(Template template, FileMetadata fmVarMet) { | ||
private DatasetVersion createNewDatasetVersion(Template template, FileMetadata fmVarMet, License license) { | ||
DatasetVersion dsv = new DatasetVersion(); | ||
dsv.setVersionState(DatasetVersion.VersionState.DRAFT); | ||
dsv.setFileMetadatas(new ArrayList<>()); | ||
DatasetVersion latestVersion; | ||
|
||
//if the latest version has values get them copied over | ||
if (template != null) { | ||
dsv.updateDefaultValuesFromTemplate(template); | ||
dsv.updateDefaultValuesFromTemplate(template, license); | ||
setVersions(new ArrayList()); | ||
} else { | ||
latestVersion = getLatestVersionForCopy(); | ||
|
@@ -317,7 +317,7 @@ private DatasetVersion createNewDatasetVersion(Template template, FileMetadata f | |
} else { | ||
TermsOfUseAndAccess terms = new TermsOfUseAndAccess(); | ||
terms.setDatasetVersion(dsv); | ||
terms.setLicense(TermsOfUseAndAccess.License.CC0); | ||
terms.setLicense(license); | ||
dsv.setTermsOfUseAndAccess(terms); | ||
} | ||
|
||
|
@@ -373,18 +373,18 @@ private DatasetVersion createNewDatasetVersion(Template template, FileMetadata f | |
* @return The edit version {@code this}. | ||
*/ | ||
public DatasetVersion getEditVersion() { | ||
return getEditVersion(null, null); | ||
return getEditVersion(null, null, null); | ||
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. Does using null here (and in the following variations of this method) cause a draft auto-generated from an earlier version to revert to no license? Could/should they inherit the license of the latest version instead? Are there any cases where you really want to send null? 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. I am not sure where this particular code is invoked, but when testing through the UI I can see that a new version inherits the license of the previous version. I think that, as a user, this is definitely what you would expect, as you also inherit the metadata and files from the previous version. If we can agree on the above as the required behavior, then we should indeed check that it is consistent throughout the application. |
||
} | ||
|
||
public DatasetVersion getEditVersion(FileMetadata fm) { | ||
return getEditVersion(null, fm); | ||
return getEditVersion(null, fm, null); | ||
} | ||
|
||
public DatasetVersion getEditVersion(Template template, FileMetadata fm) { | ||
public DatasetVersion getEditVersion(Template template, FileMetadata fm, License license) { | ||
DatasetVersion latestVersion = this.getLatestVersion(); | ||
if (!latestVersion.isWorkingCopy() || template != null) { | ||
// if the latest version is released or archived, create a new version for editing | ||
return createNewDatasetVersion(template, fm); | ||
return createNewDatasetVersion(template, fm, license); | ||
} else { | ||
// else, edit existing working copy | ||
return latestVersion; | ||
|
@@ -395,11 +395,11 @@ public DatasetVersion getEditVersion(Template template, FileMetadata fm) { | |
* @todo Investigate if this method should be deprecated in favor of | ||
* createNewDatasetVersion. | ||
*/ | ||
public DatasetVersion getCreateVersion() { | ||
public DatasetVersion getCreateVersion(License license) { | ||
DatasetVersion dsv = new DatasetVersion(); | ||
dsv.setVersionState(DatasetVersion.VersionState.DRAFT); | ||
dsv.setDataset(this); | ||
dsv.initDefaultValues(); | ||
dsv.initDefaultValues(license); | ||
this.setVersions(new ArrayList<>()); | ||
getVersions().add(0, dsv); | ||
return dsv; | ||
|
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.
Should this be "CC BY 4.0" (without the hyphens)? That's what it says at https://creativecommons.org/licenses/by/4.0/
Update: I talked to @4tikhonov and he pointed me to https://spdx.org/licenses/ which leads me to believe that "name" should be "identifer" since "CC-BY-4.0" seems to be an identifier.
However, now I'm concerned that we're showing these machine-readable identifiers in the UI. If I saw "MIT-0" in the GUI below I wouldn't know what it means but "MIT No Attribution" is clear.
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.
I think the URL is really the primary identifier and the 'name' is intended for display rather than as a second less specific way to identify the license globally. So - I think I agree that the non-hyphenated versions make more sense and we can change those (unless someone else has a concern about that?).
(Note - since these are configured via API, installations that prefer some other user-visible label (or want to have them in another language, etc.), they can still do that. The interoperability is intended to be by URL - if that matches, it's the same license.
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.
I have no objection to using a URL as a primary identifier but are our URLs aligned with SPDX, for example? It seems like not (CC-BY-4.0 example):
In short, if we're going to use URLs as identifiers it would be nice to see a canonical list of these URLs somewhere.
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.
The URLs used now are what Creative Commons has assigned to their licenses. Their page metadata include attributes like
about="http://creativecommons.org/licenses/by/4.0"
for example. While SPDX has assigned alternate URLs, I don't think it would be best practice to not follow Creative Commons. Since licenses are configurable, installations could choose to do that if they wanted to though.