Skip to content

Commit e262735

Browse files
Merge branch 'develop' into 111-address-issues-with-file-search
2 parents 9a2a745 + b8f5c1e commit e262735

File tree

87 files changed

+3553
-345
lines changed

Some content is hidden

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

87 files changed

+3553
-345
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
## Database Settings Cleanup
2+
3+
With this release, we remove some legacy specialties around Database Settings and provide better Admin API endpoints for them.
4+
5+
Most important changes:
6+
7+
1. Setting `BuiltinUsers.KEY` was renamed to `:BuiltinUsersKey`, aligned with our general naming pattern for options.
8+
2. Setting `WorkflowsAdmin#IP_WHITELIST_KEY` was renamed to `:WorkflowsAdminIpWhitelist`, aligned with our general naming pattern for options.
9+
3. Setting `:TabularIngestSizeLimit` no longer uses suffixes for formats and becomes a JSON-based setting instead.
10+
4. If set, all three settings will be migrated to their new form automatically for you (Flyway migration).
11+
5. You can no longer (accidentally) create or use arbitrary setting names or languages.
12+
All Admin API endpoints for settings now validate setting names and languages for existence and compliance.
13+
14+
As an administrator of a Dataverse instance, you can now make use of enhanced Bulk Operations on the Settings Admin API:
15+
16+
1. Retrieving all settings as JSON via `GET /api/admin/settings` supports localized options now, too.
17+
2. You can replace all existing settings in an idempotent way sending JSON to `PUT /api/admin/settings`.
18+
This will create, update and remove settings as necessary in one atomic operation.
19+
The new endpoint is especially useful to admins using GitOps or other automations.
20+
It allows control over all Database Settings from a single source without risking an undefined state.
21+
22+
Note: Despite the validation of setting names and languages, the content of any database setting is still not being validated when using the Settings Admin API!
23+
24+
### Updated Database Settings
25+
26+
The following database settings are were added to the official list within the code (to remain valid with the settings cleanup mentioned above):
27+
28+
- `:BagGeneratorThreads`
29+
- `:BagItHandlerEnabled`
30+
- `:BagItLocalPath`
31+
- `:BagValidatorJobPoolSize`
32+
- `:BagValidatorJobWaitInterval`
33+
- `:BagValidatorMaxErrors`
34+
- `:BuiltinUsersKey` - formerly `BuiltinUsers.KEY`
35+
- `:CreateDataFilesMaxErrorsToDisplay`
36+
- `:DRSArchiverConfig` - a Harvard-specific setting
37+
- `:DuraCloudContext`
38+
- `:DuraCloudHost`
39+
- `:DuraCloudPort`
40+
- `:FileCategories`
41+
- `:GoogleCloudBucket`
42+
- `:GoogleCloudProject`
43+
- `:LDNAnnounceRequiredFields`
44+
- `:LDNTarget`
45+
- `:WorkflowsAdminIpWhitelist` - formerly `WorkflowsAdmin#IP_WHITELIST_KEY`
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# 11744: CORS handling improvements
2+
3+
Modernizes CORS so browser integrations (previewers, external tools, JS clients) work correctly with multiple origins and proper caching.
4+
5+
## Highlights
6+
7+
- Echoes the request origin (`Access-Control-Allow-Origin`) when it matches `dataverse.cors.origin`.
8+
- Adds `Vary: Origin` for per-origin responses (not for wildcard).
9+
- Supports comma‑separated origin list; any `*` in the list = wildcard mode.
10+
- CORS now only enabled when `dataverse.cors.origin` is set (removed `:AllowCors` no longer enables it).
11+
- All comma-separated configuration settings (database properties and MicroProfile config) now ignore spaces around commas; tokens remain unchanged (no quote parsing). Examples: `dataverse.cors.methods`, `dataverse.cors.headers.allow`, `dataverse.cors.headers.expose`. See "Comma-separated configuration values" in the Installation Guide.
12+
- Docs updated (Installation, Big Data Support, External Tools, File Previews); new tests cover edge cases.
13+
14+
## Admin Action
15+
16+
Set `dataverse.cors.origin` explicitly (required). Use explicit origins (not `*`) for credentialed requests. Ensure proxies keep `Vary: Origin`.
17+
18+
Examples:
19+
20+
```
21+
dataverse.cors.origin=https://example.org
22+
dataverse.cors.origin=https://libis.github.io,https://gdcc.github.io
23+
dataverse.cors.origin=*
24+
```
25+
26+
Optional (unquoted):
27+
28+
```
29+
dataverse.cors.methods=GET, POST, OPTIONS, PUT, DELETE
30+
```
31+
32+
## Compatibility
33+
34+
- Must configure `dataverse.cors.origin`; `:AllowCors` was deprecated and has now been removed.
35+
- Any `*` triggers wildcard (no per-origin echo / no Vary header).
36+
37+
## Docs
38+
39+
See updated `dataverse.cors.origin` section and related notes in Big Data Support (S3), External Tools, and File Previews.
40+
41+
<!-- Maintainer note: The generic behavior for comma-separated settings has been documented centrally under Installation Guide > Configuration > "Comma-separated configuration values". Keep this item here as a cross-reference. -->
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
File level permissions: Restricted files in Draft will now show a "Draft/Unpublished" tag in the UI when granting file access
2+
3+
See #7618
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
A new API endpoint has been implemented for getting the metadata language of a Dataverse Collection:
2+
3+
`GET /dataverses/{alias}/allowedMetadataLanguages`: Returns the specified metadata language(s) in the collection if any.
4+
`PUT /dataverses/{alias}/allowedMetadataLanguages{metadataLanguage}`: Sets a metadata language in the collection.
5+
6+
For more information, see #11856 and #11856.

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

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

1010
v6.9
1111
----
12+
1213
- The POST /api/admin/makeDataCount/{id}/updateCitationsForDataset processing is now asynchronous and the response no longer includes the number of citations. The response can be OK if the request is queued or 503 if the queue is full (default queue size is 1000).
14+
- The way to set per-format size limits for tabular ingest has changed. JSON input is now used. See :ref:`:TabularIngestSizeLimit`.
15+
- 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.
1316

1417
v6.8
1518
----

doc/sphinx-guides/source/api/external-tools.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ Introduction
1111

1212
External tools are additional applications the user can access or open from your Dataverse installation to preview, explore, and manipulate data files and datasets. The term "external" is used to indicate that the tool is not part of the main Dataverse Software.
1313

14+
.. note::
15+
Browser-based tools must have CORS explicitly enabled via :ref:`dataverse.cors.origin <dataverse.cors.origin>`. List every origin that will host your tool (or use ``*`` when a wildcard is acceptable). If an origin is not listed, the browser will block that tool's API requests even if the tool page itself loads.
16+
1417
Once you have created the external tool itself (which is most of the work!), you need to teach a Dataverse installation how to construct URLs that your tool needs to operate. For example, if you've deployed your tool to fabulousfiletool.com your tool might want the ID of a file and the siteUrl of the Dataverse installation like this: https://fabulousfiletool.com?fileId=42&siteUrl=https://demo.dataverse.org
1518

1619
In short, you will be creating a manifest in JSON format that describes not only how to construct URLs for your tool, but also what types of files your tool operates on, where it should appear in the Dataverse installation web interfaces, etc.

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

Lines changed: 220 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,51 @@ The fully expanded example above (without environment variables) looks like this
287287
288288
curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" "https://demo.dataverse.org/api/dataverses/root/roles"
289289
290+
List the Allowed Metadata Languages of a Dataverse Collection
291+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
292+
293+
Shows the allowed metadata languages of the Dataverse collection ``id``:
294+
295+
.. code-block:: bash
296+
297+
export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
298+
export SERVER_URL=https://demo.dataverse.org
299+
export ID=root
300+
301+
curl -H "X-Dataverse-key:$API_TOKEN" "$SERVER_URL/api/dataverses/$ID/allowedMetadataLanguages"
302+
303+
The fully expanded example above (without environment variables) looks like this:
304+
305+
.. code-block:: bash
306+
307+
curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" "https://demo.dataverse.org/api/dataverses/root/allowedMetadataLanguages"
308+
309+
If there are no metadata languages configured on the server, this call returns an empty array. If the Dataverse collection has a mandatory metadata language, the return value is an array of that single language,
310+
otherwise it's an array of all available metadata languages on the server.
311+
312+
Set the Allowed Metadata Language of a Dataverse Collection
313+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
314+
315+
Sets the allowed metadata language of the Dataverse collection ``id`` to ``langCode`` if it's available on the server:
316+
317+
.. code-block:: bash
318+
319+
export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
320+
export SERVER_URL=https://demo.dataverse.org
321+
export ID=root
322+
export LANGCODE=en
323+
324+
curl -H "X-Dataverse-key:$API_TOKEN" -X PUT "$SERVER_URL/api/dataverses/$ID/allowedMetadataLanguages/$LANGCODE"
325+
326+
The fully expanded example above (without environment variables) looks like this:
327+
328+
.. code-block:: bash
329+
330+
curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X PUT "https://demo.dataverse.org/api/dataverses/root/allowedMetadataLanguages/en"
331+
332+
Returns an array of the set metadata language.
333+
If the metadata language is not available on the server, this call responds with a 400 BAD REQUEST.
334+
290335
List Facets Configured for a Dataverse Collection
291336
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
292337

@@ -5843,13 +5888,13 @@ Builtin users are known as "Username/Email and Password" users in the :doc:`/use
58435888
Create a Builtin User
58445889
~~~~~~~~~~~~~~~~~~~~~
58455890
5846-
For security reasons, builtin users cannot be created via API unless the team who runs the Dataverse installation has populated a database setting called ``BuiltinUsers.KEY``, which is described under :ref:`securing-your-installation` and :ref:`database-settings` sections of Configuration in the Installation Guide. You will need to know the value of ``BuiltinUsers.KEY`` before you can proceed.
5891+
For security reasons, builtin users cannot be created via API unless the team who runs the Dataverse installation has populated a database setting called ``:BuiltinUsersKey``, which is described under :ref:`securing-your-installation` and :ref:`database-settings` sections of Configuration in the Installation Guide. You will need to know the value of ``:BuiltinUsersKey`` before you can proceed.
58475892
58485893
To create a builtin user via API, you must first construct a JSON document. You can download :download:`user-add.json <../_static/api/user-add.json>` or copy the text below as a starting point and edit as necessary.
58495894
58505895
.. literalinclude:: ../_static/api/user-add.json
58515896
5852-
Place this ``user-add.json`` file in your current directory and run the following curl command, substituting variables as necessary. Note that both the password of the new user and the value of ``BuiltinUsers.KEY`` are passed as query parameters::
5897+
Place this ``user-add.json`` file in your current directory and run the following curl command, substituting variables as necessary. Note that both the password of the new user and the value of ``:BuiltinUsersKey`` are passed as query parameters::
58535898
58545899
curl -d @user-add.json -H "Content-type:application/json" "$SERVER_URL/api/builtin-users?password=$NEWUSER_PASSWORD&key=$BUILTIN_USERS_KEY"
58555900
@@ -7133,35 +7178,193 @@ If the PID is not managed by Dataverse, this call will report if the PID is reco
71337178
Admin
71347179
-----
71357180
7136-
This is the administrative part of the API. For security reasons, it is absolutely essential that you block it before allowing public access to a Dataverse installation. Blocking can be done using settings. See the ``post-install-api-block.sh`` script in the ``scripts/api`` folder for details. See :ref:`blocking-api-endpoints` in Securing Your Installation section of the Configuration page of the Installation Guide.
7181+
This is the administrative part of the API.
7182+
For security reasons, it is absolutely essential that you block it before allowing public access to a Dataverse installation.
7183+
See :ref:`blocking-api-endpoints` in the Installation Guide for details.
7184+
7185+
.. note:: See :ref:`curl-examples-and-environment-variables` if you are unfamiliar with the use of export below.
7186+
7187+
.. _admin-api-db-settings:
7188+
7189+
Manage Database Settings
7190+
~~~~~~~~~~~~~~~~~~~~~~~~
7191+
7192+
These are the API endpoints for managing the :ref:`database-settings` listed in the Installation Guide.
7193+
7194+
.. _settings_get_all:
71377195
71387196
List All Database Settings
7139-
~~~~~~~~~~~~~~~~~~~~~~~~~~
7197+
^^^^^^^^^^^^^^^^^^^^^^^^^^
71407198
7141-
List all settings::
7199+
.. code-block:: bash
71427200
7143-
GET http://$SERVER/api/admin/settings
7201+
export SERVER_URL="http://localhost:8080"
7202+
7203+
curl "$SERVER_URL/api/admin/settings"
71447204
7145-
Configure Database Setting
7146-
~~~~~~~~~~~~~~~~~~~~~~~~~~
7205+
The fully expanded example above (without environment variables) looks like this:
7206+
7207+
.. code-block:: bash
71477208
7148-
Sets setting ``name`` to the body of the request::
7209+
curl http://localhost:8080/api/admin/settings
71497210
7150-
PUT http://$SERVER/api/admin/settings/$name
7211+
.. _settings_get_single:
71517212
71527213
Get Single Database Setting
7153-
~~~~~~~~~~~~~~~~~~~~~~~~~~~
7214+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
71547215
7155-
Get the setting under ``name``::
7216+
.. code-block:: bash
71567217
7157-
GET http://$SERVER/api/admin/settings/$name
7218+
export SERVER_URL="http://localhost:8080"
7219+
export NAME=":UploadMethods"
7220+
7221+
curl "$SERVER_URL/api/admin/settings/$NAME"
71587222
7159-
Delete Database Setting
7160-
~~~~~~~~~~~~~~~~~~~~~~~
7223+
The fully expanded example above (without environment variables) looks like this:
7224+
7225+
.. code-block:: bash
7226+
7227+
curl http://localhost:8080/api/admin/settings/:UploadMethods
7228+
7229+
.. _settings_get_single_lang:
7230+
7231+
Get Single Database Setting With Language/Locale
7232+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7233+
7234+
A small number of settings, most notably :ref:`:ApplicationTermsOfUse`, can be saved in multiple languages.
7235+
7236+
Use two-character ISO 639-1 language codes.
7237+
7238+
.. code-block:: bash
7239+
7240+
export SERVER_URL="http://localhost:8080"
7241+
export NAME=":ApplicationTermsOfUse"
7242+
export LANG="en"
7243+
7244+
curl "$SERVER_URL/api/admin/settings/$NAME/lang/$LANG"
7245+
7246+
The fully expanded example above (without environment variables) looks like this:
7247+
7248+
.. code-block:: bash
7249+
7250+
curl http://localhost:8080/api/admin/settings/:ApplicationTermsOfUse/lang/en
71617251
7162-
Delete the setting under ``name``::
7252+
.. _settings_put_single:
7253+
7254+
Configure Single Database Setting
7255+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7256+
7257+
.. code-block:: bash
7258+
7259+
export SERVER_URL="http://localhost:8080"
7260+
export NAME=":InstallationName"
7261+
export VALUE="LibreScholar"
7262+
7263+
curl -X PUT "$SERVER_URL/api/admin/settings/$NAME" -d "$VALUE"
7264+
7265+
The fully expanded example above (without environment variables) looks like this:
7266+
7267+
.. code-block:: bash
7268+
7269+
curl -X PUT http://localhost:8080/api/admin/settings/:InstallationName -d LibreScholar
7270+
7271+
Note: ``NAME`` values are validated for existence and compliance.
7272+
7273+
.. _settings_put_single_lang:
7274+
7275+
Configure Single Database Setting With Language/Locale
7276+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7277+
7278+
A small number of settings, most notably :ref:`:ApplicationTermsOfUse`, can be saved in multiple languages.
7279+
7280+
Use two-character ISO 639-1 language codes.
7281+
7282+
.. code-block:: bash
7283+
7284+
export SERVER_URL="http://localhost:8080"
7285+
export NAME=":ApplicationTermsOfUse"
7286+
export LANG="fr"
7287+
7288+
curl -X PUT "$SERVER_URL/api/admin/settings/$NAME/lang/$LANG" --upload-file /tmp/apptou_fr.html
7289+
7290+
The fully expanded example above (without environment variables) looks like this:
7291+
7292+
.. code-block:: bash
7293+
7294+
curl -X PUT http://localhost:8080/api/admin/settings/:ApplicationTermsOfUse/lang/fr --upload-file /tmp/apptou_fr.html
7295+
7296+
Note: ``NAME`` and ``LANG`` values are validated for existence and compliance.
7297+
7298+
.. _settings_put_bulk:
7299+
7300+
Configure All Database Settings
7301+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7302+
7303+
Using a JSON file, replace all settings in a single idempotent and atomic operation and delete any settings not present in that JSON file.
7304+
7305+
Use the JSON ``data`` object in output of ``GET /api/admin/settings`` (:ref:`settings_get_all`) for the JSON input structure for this endpoint.
7306+
To put this concretely, you can save just the ``data`` object for your existing settings to disk by filtering them through ``jq`` like this:
7307+
7308+
.. code-block:: bash
7309+
7310+
curl http://localhost:8080/api/admin/settings | jq '.data' > /tmp/all-settings.json
7311+
7312+
Then you can use this "all-settings.json" file as a starting point for your input file.
7313+
The :doc:`../installation/config` page of the Installation Guide has a :ref:`complete list of all the available settings <database-settings>`.
7314+
Note that settings in the JSON file are validated for existence and compliance.
7315+
7316+
.. code-block:: bash
7317+
7318+
export SERVER_URL="http://localhost:8080"
7319+
7320+
curl -X PUT -H "Content-type:application/json" "$SERVER_URL/api/admin/settings" --upload-file /tmp/all-settings.json
7321+
7322+
The fully expanded example above (without environment variables) looks like this:
7323+
7324+
.. code-block:: bash
7325+
7326+
curl -X PUT -H "Content-type:application/json" http://localhost:8080/api/admin/settings --upload-file /tmp/all-settings.json
7327+
7328+
.. _settings_delete_single:
7329+
7330+
Delete Single Database Setting
7331+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7332+
7333+
.. code-block:: bash
7334+
7335+
export SERVER_URL="http://localhost:8080"
7336+
export NAME=":InstallationName"
7337+
7338+
curl -X DELETE "$SERVER_URL/api/admin/settings/$NAME"
7339+
7340+
The fully expanded example above (without environment variables) looks like this:
7341+
7342+
.. code-block:: bash
7343+
7344+
curl -X DELETE http://localhost:8080/api/admin/settings/:InstallationName
7345+
7346+
.. _settings_delete_single_lang:
7347+
7348+
Delete Single Database Setting With Language/Locale
7349+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7350+
7351+
A small number of settings, most notably :ref:`:ApplicationTermsOfUse`, can be saved in multiple languages.
7352+
7353+
Use two-character ISO 639-1 language codes.
7354+
7355+
.. code-block:: bash
7356+
7357+
export SERVER_URL="http://localhost:8080"
7358+
export NAME=":ApplicationTermsOfUse"
7359+
export LANG="fr"
7360+
7361+
curl -X DELETE "$SERVER_URL/api/admin/settings/$NAME/lang/$LANG"
7362+
7363+
The fully expanded example above (without environment variables) looks like this:
7364+
7365+
.. code-block:: bash
71637366
7164-
DELETE http://$SERVER/api/admin/settings/$name
7367+
curl -X DELETE http://localhost:8080/api/admin/settings/:ApplicationTermsOfUse/lang/fr
71657368
71667369
.. _list-all-feature-flags:
71677370

0 commit comments

Comments
 (0)