Skip to content

Conversation

GPortas
Copy link
Contributor

@GPortas GPortas commented Sep 12, 2025

What this PR does / why we need it:

New Endpoint: /datasets/{id}/license

A new endpoint has been implemented to manage dataset licenses.

Functionality

  • Updates the license of a dataset by applying it to the draft version.
  • If no draft exists, a new one is automatically created.

Usage

This endpoint supports two ways of defining a license:

  1. Predefined License – Provide the license name (e.g., CC BY 4.0).
  2. Custom Terms of Use and Access – Provide a JSON body with the customTerms object.
    • All fields are optional except termsOfUse, which is required.

Which issue(s) this PR closes:

Suggestions on how to test this:

curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X PUT "https://demo.dataverse.org/api/datasets/<dataset_id>/license" -H "Content-type:application/json" --upload-file <json_file_path>

To set a predefined license (e.g., CC BY 4.0), provide a JSON body with the license name:

  {
    "name": "CC BY 4.0"
  }

To define custom terms of use and access, provide a JSON body with the following properties. All fields within customTerms are optional, except for the termsOfUse field, which is required:

  {
    "customTerms": {
        "termsOfUse": "Your terms of use",
        "confidentialityDeclaration": "Your confidentiality declaration",
        "specialPermissions": "Your special permissions",
        "restrictions": "Your restrictions",
        "citationRequirements": "Your citation requirements",
        "depositorRequirements": "Your depositor requirements",
        "conditions": "Your conditions",
        "disclaimer": "Your disclaimer"
    }
  }

Does this PR introduce a user interface change? If mockups are available, please link/include them here:
None

Is there a release notes update needed for this change?:
Attached

@coveralls
Copy link

coveralls commented Sep 12, 2025

Coverage Status

coverage: 23.554% (+0.02%) from 23.539%
when pulling e253f22 on 11771-set-dataset-license-api
into 90e770e on develop.

This comment has been minimized.

1 similar comment

This comment has been minimized.

This comment has been minimized.

1 similar comment

This comment has been minimized.

This comment has been minimized.

@GPortas GPortas moved this to Ready for Review ⏩ in IQSS Dataverse Project Sep 17, 2025
@GPortas GPortas added SPA These changes are required for the Dataverse SPA GREI Re-arch Issues related to the GREI Dataverse rearchitecture SPA.Q3.2025.3 Dataset Page: Edit Terms Size: 3 A percentage of a sprint. 2.1 hours. Original size: 3 labels Sep 17, 2025
@GPortas GPortas marked this pull request as ready for review September 17, 2025 18:12

This comment has been minimized.

This comment has been minimized.

1 similar comment
Copy link

📦 Pushed preview images as

ghcr.io/gdcc/dataverse:11771-set-dataset-license-api
ghcr.io/gdcc/configbaker:11771-set-dataset-license-api

🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name.

@cmbz cmbz added the FY26 Sprint 6 FY26 Sprint 6 (2025-09-10 - 2025-09-24) label Sep 24, 2025
@cmbz cmbz added the FY26 Sprint 7 FY26 Sprint 7 (2025-09-24 - 2025-10-08) label Sep 24, 2025
@sekmiller sekmiller self-assigned this Oct 7, 2025
@sekmiller sekmiller moved this from Ready for Review ⏩ to In Review 🔎 in IQSS Dataverse Project Oct 7, 2025
return ok(BundleUtil.getStringFromBundle("datasets.api.updateLicense.success"));
} else if (requestBody.getCustomTerms() != null) {
CustomTermsDTO customTerms = requestBody.getCustomTerms();
execCommand(new UpdateDatasetLicenseCommand(req, dataset, customTerms.toTermsOfUseAndAccess()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't do anything to preserve whatever has been entered for File Access Requests or Terms of Access so it will fail if the dataset has any restricted files. In the absence of restricted files would we still want to wipe out whatever may have been entered with respect to data file access?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or the other TermsOfUseAndAccess fields (originalArchive, sizeOfCollection, ...).

@sekmiller
Copy link
Contributor

@GPortas please take a look at how the setting of custom terms of will delete any entries in custom terms of access. I ended up reworking #11772 so that the api will only modify the terms of access and leave the license or custom terms of use the same as they were prior to the update. A more radical approach would have been to split the terms of use and access tables into two tables but that seemed like too much to take on here.

@cmbz cmbz added the FY26 Sprint 8 FY26 Sprint 8 (2025-10-08 - 2025-10-22) label Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FY26 Sprint 6 FY26 Sprint 6 (2025-09-10 - 2025-09-24) FY26 Sprint 7 FY26 Sprint 7 (2025-09-24 - 2025-10-08) FY26 Sprint 8 FY26 Sprint 8 (2025-10-08 - 2025-10-22) GREI Re-arch Issues related to the GREI Dataverse rearchitecture Original size: 3 Size: 3 A percentage of a sprint. 2.1 hours. SPA.Q3.2025.3 Dataset Page: Edit Terms SPA These changes are required for the Dataverse SPA

Projects

Status: In Review 🔎

Development

Successfully merging this pull request may close these issues.

API: Set configuring licenses and custom terms for a dataset

5 participants