Skip to content

Commit b3aea84

Browse files
committed
Merge branch 'develop' into 11639-db-opts-idempotency #11639
Conflicts: doc/sphinx-guides/source/api/changelog.rst
2 parents 9ac65d4 + bbc9bd4 commit b3aea84

48 files changed

Lines changed: 1232 additions & 705 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

conf/keycloak/builtin-users-spi/src/main/java/edu/harvard/iq/keycloak/auth/spi/services/DataverseUserService.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,16 @@ public DataverseUser getUserById(String id) {
2727

2828
DataverseBuiltinUser builtinUser = em.find(DataverseBuiltinUser.class, persistenceId);
2929
if (builtinUser == null) {
30-
logger.debugf("User not found for external ID: %s", persistenceId);
30+
logger.debugf("Builtin user not found for external ID: %s", persistenceId);
3131
return null;
3232
}
3333

34-
DataverseAuthenticatedUser authenticatedUser = getAuthenticatedUserByUsername(builtinUser.getUsername());
34+
String username = builtinUser.getUsername();
35+
DataverseAuthenticatedUser authenticatedUser = getAuthenticatedUserByUsername(username);
36+
if (authenticatedUser == null) {
37+
logger.debugf("Authenticated user not found by username: %s", username);
38+
return null;
39+
}
3540

3641
return new DataverseUser(authenticatedUser, builtinUser);
3742
}
@@ -43,11 +48,15 @@ public DataverseUser getUserByUsername(String username) {
4348
.getResultList();
4449

4550
if (users.isEmpty()) {
46-
logger.debugf("User not found by username: %s", username);
51+
logger.debugf("Builtin user not found by username: %s", username);
4752
return null;
4853
}
4954

5055
DataverseAuthenticatedUser authenticatedUser = getAuthenticatedUserByUsername(username);
56+
if (authenticatedUser == null) {
57+
logger.debugf("Authenticated user not found by username: %s", username);
58+
return null;
59+
}
5160

5261
return new DataverseUser(authenticatedUser, users.get(0));
5362
}
@@ -59,7 +68,7 @@ public DataverseUser getUserByEmail(String email) {
5968
.getResultList();
6069

6170
if (authUsers.isEmpty()) {
62-
logger.debugf("User not found by email: %s", email);
71+
logger.debugf("Authenticated user not found by email: %s", email);
6372
return null;
6473
}
6574

@@ -68,6 +77,11 @@ public DataverseUser getUserByEmail(String email) {
6877
.setParameter("username", username)
6978
.getResultList();
7079

80+
if (builtinUsers.isEmpty()) {
81+
logger.debugf("Builtin user not found by username: %s", username);
82+
return null;
83+
}
84+
7185
return new DataverseUser(authUsers.get(0), builtinUsers.get(0));
7286
}
7387

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
### Feature Request: API endpoint for analytics.html
2+
3+
New API to get the analytics.html from settings for SPA (Also can be used to get homePage, header, footer, style, and logo)
4+
5+
See also [the guides](https://dataverse-guide--11359.org.readthedocs.build/en/11359/installation/config.html#web-analytics-code), #11448.

doc/release-notes/11465-api-fetch-download-size-file-count.md

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Implemented a new feature flag ``dataverse.feature.api-bearer-auth-use-shib-user-on-id-match``, which supports the use of the new Dataverse client in instances that have historically allowed login via Shibboleth. Specifically, with this flag enabled, when an OIDC bridge is configured to allow OIDC login with validation by the bridged Shibboleth providers, users with existing Shibboleth-based accounts in Dataverse can log in to those accounts, thereby maintaining access to their existing content and retaining their roles. (For security reasons, Dataverse's current support for direct login via Shibboleth cannot be used in browser-based clients.)

doc/release-notes/11629-CSLFix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The styled citations available through the "View Styled Citations" menu were including extra characters, e.g. 'doi:' in the URL form of the PIDs in the citation. This is now fixed.
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.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
### Get Dataset File Available Categories API
2+
3+
- This new endpoint allows the user to get all of the available file categories for a dataset, both built-in and custom.
4+

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/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
- The way to set per-format size limits for tabular ingest has changed. JSON input is now used. See :ref:`:TabularIngestSizeLimit`.
1517
- In the past, the settings API would accept any key and value. This is no longer the case because validation has been added. See :ref:`settings_put_single`, for example.
1618

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

Lines changed: 91 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,8 +1840,6 @@ The returned file counts are based on different criteria:
18401840
- Per tabular tag name
18411841
- Per access status (Possible values: Public, Restricted, EmbargoedThenRestricted, EmbargoedThenPublic, RetentionPeriodExpired)
18421842

1843-
Note: Authentication is required. This call will return a 403/Forbidden response for Guest users.
1844-
18451843
.. code-block:: bash
18461844
18471845
export SERVER_URL=https://demo.dataverse.org
@@ -2823,7 +2821,6 @@ Get the size of Downloading all the files of a Dataset Version
28232821
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28242822

28252823
Shows the combined size in bytes of all the files available for download from version ``versionId`` of dataset ``id``.
2826-
Note: Authentication is required. This call will return a 403/Forbidden response for Guest users.
28272824

28282825
.. code-block:: bash
28292826
@@ -3592,6 +3589,21 @@ See :ref:`:CustomDatasetSummaryFields` in the Installation Guide for how the lis
35923589
35933590
curl "$SERVER_URL/api/datasets/summaryFieldNames"
35943591
3592+
.. _get-available-dataset-file-categories:
3593+
3594+
Get Available Dataset File Categories
3595+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3596+
3597+
This api returns a list of Categories that may be applied to the files of a given dataset.
3598+
3599+
.. code-block:: bash
3600+
3601+
export SERVER_URL=https://demo.dataverse.org
3602+
export PERSISTENT_IDENTIFIER=doi:10.5072/FK2/YD5QDG
3603+
3604+
curl "$SERVER_URL/api/datasets/:persistentId/availableFileCategories?persistentId=$PERSISTENT_IDENTIFIER"
3605+
3606+
35953607
.. _guestbook-at-request-api:
35963608

35973609
Configure When a Dataset Guestbook Appears (If Enabled)
@@ -5821,6 +5833,34 @@ The fully expanded example above (without environment variables) looks like this
58215833
58225834
curl "https://demo.dataverse.org/api/info/exportFormats"
58235835
5836+
Get Customization File Contents
5837+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5838+
5839+
The Customization API is used to retrieve the analytics-code.html as well as other customization file contents.
5840+
5841+
See also :ref:`web-analytics-code` in the Configuration section of the Installation Guide and :ref:`Branding Your Installation`
5842+
5843+
The Content-Type returned in the header is based on the media type of the file being returned (example: analytics-code.html returns "text/html; charset=UTF-8"
5844+
5845+
Valid types are "homePage", "header", "footer", "style", "analytics", and "logo".
5846+
5847+
A curl example getting the analytics-code
5848+
5849+
.. code-block:: bash
5850+
5851+
export SERVER_URL=https://demo.dataverse.org
5852+
export TYPE=analytics
5853+
5854+
curl -X GET "$SERVER_URL/api/info/settings/customization/$TYPE"
5855+
5856+
The fully expanded example above (without environment variables) looks like this:
5857+
5858+
.. code-block:: bash
5859+
5860+
curl -X GET "https://demo.dataverse.org/api/info/settings/customization/analytics"
5861+
5862+
.. _customization-analytics:
5863+
58245864
.. _metadata-blocks-api:
58255865
58265866
Metadata Blocks
@@ -5932,6 +5972,8 @@ Notifications
59325972
59335973
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.
59345974
5975+
.. _get-all-notifications:
5976+
59355977
Get All Notifications by User
59365978
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59375979
@@ -5941,6 +5983,52 @@ Each user can get a dump of their notifications by passing in their API token:
59415983
59425984
curl -H "X-Dataverse-key:$API_TOKEN" "$SERVER_URL/api/notifications/all"
59435985
5986+
The expected OK (200) response looks something like this:
5987+
5988+
.. code-block:: text
5989+
5990+
{
5991+
"status": "OK",
5992+
"data": {
5993+
"notifications": [
5994+
{
5995+
"id": 38,
5996+
"type": "CREATEACC",
5997+
"displayAsRead": true,
5998+
"subjectText": "Root: Your account has been created",
5999+
"messageText": "Hello, \nWelcome to...",
6000+
"sentTimestamp": "2025-07-21T19:15:37Z"
6001+
}
6002+
...
6003+
6004+
Get Unread Count
6005+
~~~~~~~~~~~~~~~~
6006+
6007+
You can get a count of your unread notifications as shown below.
6008+
6009+
.. code-block:: bash
6010+
6011+
curl -H "X-Dataverse-key:$API_TOKEN" -X GET "$SERVER_URL/api/notifications/unreadCount"
6012+
6013+
Mark Notification As Read
6014+
~~~~~~~~~~~~~~~~~~~~~~~~~
6015+
6016+
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.
6017+
6018+
.. code-block:: bash
6019+
6020+
export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
6021+
export SERVER_URL=https://demo.dataverse.org
6022+
export NOTIFICATION_ID=555
6023+
6024+
curl -H "X-Dataverse-key:$API_TOKEN" -X PUT "$SERVER_URL/api/notifications/$NOTIFICATION_ID/markAsRead"
6025+
6026+
The fully expanded example above (without environment variables) looks like this:
6027+
6028+
.. code-block:: bash
6029+
6030+
curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X PUT "https://demo.dataverse.org/api/notifications/555/markAsRead"
6031+
59446032
Delete Notification by User
59456033
~~~~~~~~~~~~~~~~~~~~~~~~~~~
59466034

0 commit comments

Comments
 (0)