Skip to content

Commit 9d00ef3

Browse files
committed
Merge branch 'develop' into 11634-api-get-available-file-categories
2 parents 63eb80d + d27d4c7 commit 9d00ef3

24 files changed

+229
-59
lines changed

doc/release-notes/11534-link-permissions.md

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The [API for listing the collections a dataverse has been linked to](https://guides.dataverse.org/en/latest/admin/dataverses-datasets.html#list-dataverse-collection-links) (`api/dataverses/$dataverse-alias/links`) has been refactored to return a new Json format. This is a breaking API.

doc/release-notes/11650-unread.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## API Updates
2+
3+
### Support read/unread status for notifications
4+
5+
The API for managing notifications has been extended.
6+
7+
- displayAsRead boolean added to "get all"
8+
- new GET unreadCount API endpoint
9+
- new PUT markAsRead API endpoint
10+
11+
See also [the guides](https://dataverse-guide--11664.org.readthedocs.build/en/11664/api/native-api.html#notifications), #11650, and #11664.

doc/sphinx-guides/source/admin/dataverses-datasets.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Moves a dataset whose id is passed to a Dataverse collection whose alias is pass
118118
Link a Dataset
119119
^^^^^^^^^^^^^^
120120

121-
Creates a link between a dataset and a Dataverse collection (see the :ref:`dataset-linking` section of the User Guide for more information). Accessible to users with Link Dataset permission on the Dataverse collection. ::
121+
Creates a link between a dataset and a Dataverse collection (see the :ref:`dataset-linking` section of the User Guide for more information). ::
122122

123123
curl -H "X-Dataverse-key: $API_TOKEN" -X PUT http://$SERVER/api/datasets/$linked-dataset-id/link/$linking-dataverse-alias
124124

@@ -155,7 +155,7 @@ It returns a list in the following format (new format as of v6.4):
155155
Unlink a Dataset
156156
^^^^^^^^^^^^^^^^
157157

158-
Removes a link between a dataset and a Dataverse collection. Accessible to users with Link Dataset permission on the Dataverse collection. ::
158+
Removes a link between a dataset and a Dataverse collection. Accessible to users with Publish Dataset permissions. ::
159159

160160
curl -H "X-Dataverse-key: $API_TOKEN" -X DELETE http://$SERVER/api/datasets/$linked-dataset-id/deleteLink/$linking-dataverse-alias
161161

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ This API changelog is experimental and we would love feedback on its usefulness.
99

1010
v6.8
1111
----
12+
1213
- For POST /api/files/{id}/metadata passing an empty string ("description":"") or array ("categories":[]) will no longer be ignored. Empty fields will now clear out the values in the file's metadata. To ignore the fields simply do not include them in the JSON string.
1314
- For PUT /api/datasets/{id}/editMetadata the query parameter "sourceInternalVersionNumber" has been removed and replaced with "sourceLastUpdateTime" to verify that the data being edited hasn't been modified and isn't stale.
15+
- For GET /api/dataverses/$dataverse-alias/links the Json response has changed breaking the backward compatibility of the API.
1416

1517
v6.7
1618
----

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

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5947,6 +5947,8 @@ Notifications
59475947
59485948
See :ref:`account-notifications` in the User Guide for an overview. For a list of all the notification types mentioned below (e.g. ASSIGNROLE), see :ref:`mute-notifications` in the Admin Guide.
59495949
5950+
.. _get-all-notifications:
5951+
59505952
Get All Notifications by User
59515953
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59525954
@@ -5956,6 +5958,52 @@ Each user can get a dump of their notifications by passing in their API token:
59565958
59575959
curl -H "X-Dataverse-key:$API_TOKEN" "$SERVER_URL/api/notifications/all"
59585960
5961+
The expected OK (200) response looks something like this:
5962+
5963+
.. code-block:: text
5964+
5965+
{
5966+
"status": "OK",
5967+
"data": {
5968+
"notifications": [
5969+
{
5970+
"id": 38,
5971+
"type": "CREATEACC",
5972+
"displayAsRead": true,
5973+
"subjectText": "Root: Your account has been created",
5974+
"messageText": "Hello, \nWelcome to...",
5975+
"sentTimestamp": "2025-07-21T19:15:37Z"
5976+
}
5977+
...
5978+
5979+
Get Unread Count
5980+
~~~~~~~~~~~~~~~~
5981+
5982+
You can get a count of your unread notifications as shown below.
5983+
5984+
.. code-block:: bash
5985+
5986+
curl -H "X-Dataverse-key:$API_TOKEN" -X GET "$SERVER_URL/api/notifications/unreadCount"
5987+
5988+
Mark Notification As Read
5989+
~~~~~~~~~~~~~~~~~~~~~~~~~
5990+
5991+
After finding the ID of a notification using :ref:`get-all-notifications`, you can pass it to the "markAsRead" API endpoint as shown below. Note that this endpoint is idempotent; you can mark an already-read notification as read over and over.
5992+
5993+
.. code-block:: bash
5994+
5995+
export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
5996+
export SERVER_URL=https://demo.dataverse.org
5997+
export NOTIFICATION_ID=555
5998+
5999+
curl -H "X-Dataverse-key:$API_TOKEN" -X PUT "$SERVER_URL/api/notifications/$NOTIFICATION_ID/markAsRead"
6000+
6001+
The fully expanded example above (without environment variables) looks like this:
6002+
6003+
.. code-block:: bash
6004+
6005+
curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X PUT "https://demo.dataverse.org/api/notifications/555/markAsRead"
6006+
59596007
Delete Notification by User
59606008
~~~~~~~~~~~~~~~~~~~~~~~~~~~
59616009

doc/sphinx-guides/source/user/dataverse-management.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ Dataset linking allows a Dataverse collection owner to "link" their Dataverse co
215215

216216
For example, researchers working on a collaborative study across institutions can each link their own individual institutional Dataverse collections to the one collaborative dataset, making it easier for interested parties from each institution to find the study.
217217

218-
In order to link a dataset, you will need your account to have the "Link Dataset" permission on the Dataverse collection that is doing the linking. If you created the Dataverse collection then you should have this permission already, but if not then you will need to ask the admin of that Dataverse collection to assign that permission to your account. You do not need any special permissions on the dataset being linked.
218+
In order to link a dataset, you will need your account to have the "Publish Dataset" permission on the Dataverse collection that is doing the linking. If you created the Dataverse collection then you should have this permission already, but if not then you will need to ask the admin of that Dataverse collection to assign that permission to your account. You do not need any special permissions on the dataset being linked.
219219

220220
To link a dataset to your Dataverse collection, you must navigate to that dataset and click the white "Link" button in the upper-right corner of the dataset page. This will open up a window where you can type in the name of the Dataverse collection that you would like to link the dataset to. Select your Dataverse collection and click the save button. This will establish the link, and the dataset will now appear under your Dataverse collection.
221221

scripts/api/data/role-curator.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
{
22
"alias":"curator",
33
"name":"Curator",
4-
"description":"For datasets, a person who can edit License + Terms, edit Permissions, and publish and link datasets.",
4+
"description":"For datasets, a person who can edit License + Terms, edit Permissions, and publish datasets.",
55
"permissions":[
66
"ViewUnpublishedDataset",
77
"EditDataset",
88
"DownloadFile",
99
"DeleteDatasetDraft",
1010
"PublishDataset",
11-
"LinkDataset",
1211
"ManageDatasetPermissions",
1312
"ManageFilePermissions",
1413
"AddDataverse",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ public List<Dataverse> filterDataversesForLinking(String query, DataverseRequest
512512

513513
for (Dataverse res : results) {
514514
if (!remove.contains(res)) {
515-
if (this.permissionService.requestOn(req, res).has(Permission.LinkDataset)) {
515+
if (this.permissionService.requestOn(req, res).has(Permission.PublishDataset)) {
516516
dataverseList.add(res);
517517
}
518518
}
@@ -525,7 +525,7 @@ public List<Dataverse> filterDataversesForUnLinking(String query, DataverseReque
525525
List<Dataverse> dataverseList = new ArrayList<>();
526526
if (alreadyLinkeddv_ids != null && !alreadyLinkeddv_ids.isEmpty()) {
527527
alreadyLinkeddv_ids.stream().map((testDVId) -> this.find(testDVId)).forEachOrdered((dataverse) -> {
528-
if (this.permissionService.requestOn(req, dataverse).has(Permission.LinkDataset)) {
528+
if (this.permissionService.requestOn(req, dataverse).has(Permission.PublishDataset)) {
529529
dataverseList.add(dataverse);
530530
}
531531
});

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,12 @@ public UserNotification find(Object pk) {
8787
public UserNotification save(UserNotification userNotification) {
8888
return em.merge(userNotification);
8989
}
90-
90+
91+
public UserNotification markAsRead(UserNotification userNotification) {
92+
userNotification.setReadNotification(true);
93+
return em.merge(userNotification);
94+
}
95+
9196
public void delete(UserNotification userNotification) {
9297
em.remove(em.merge(userNotification));
9398
}

0 commit comments

Comments
 (0)