Skip to content

Allow Preview User to download files without requiring a Guestbook Re… - #12584

Open
stevenwinship wants to merge 9 commits into
developfrom
12535-download-without-guestbook-response-for-preview-user2
Open

Allow Preview User to download files without requiring a Guestbook Re…#12584
stevenwinship wants to merge 9 commits into
developfrom
12535-download-without-guestbook-response-for-preview-user2

Conversation

@stevenwinship

@stevenwinship stevenwinship commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

The guestbook popup does not appear to collect a response before the download attempt is made. Disabling the guestbook on the dataset resolves the issue and files download normally through the Preview URL. This fix reinstates the behavior of the JSF UI from prior versions of Dataverse.

Which issue(s) this PR closes:#12535

Closes #12535
Closes #12579
Special notes for your reviewer:

Suggestions on how to test this: Create a dataset with a guestbook. Generate a Preview URL. Using the preview url try to download files and dataset zip file. This should work without requiring the guestbook response.

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

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

Additional documentation:

@stevenwinship stevenwinship self-assigned this Aug 3, 2026
@github-actions github-actions Bot added FY27 Sprint 1 FY27 Sprint 1 (2026-07-01 - 2026-07-15) FY27 Sprint 2 FY27 Sprint 2 (2026-07-15 - 2026-07-29) Original size: 20 Type: Bug a defect labels Aug 3, 2026
@stevenwinship stevenwinship moved this to In Progress 💻 in IQSS Dataverse Project Aug 3, 2026
@stevenwinship stevenwinship added this to the 6.12 milestone Aug 3, 2026
@stevenwinship

Copy link
Copy Markdown
Contributor Author

This PR replaces #12548

Dataset d = df.getOwner();
boolean required = df.getOwner().hasEnabledGuestbook() && !d.getEffectiveGuestbookEntryAtRequest();
Dataset ds = df.getOwner();
boolean required = ds.hasEnabledGuestbook() && !ds.getEffectiveGuestbookEntryAtRequest() && !(user instanceof PrivateUrlUser);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this skips checking if the PrivateUrlUser has access to this dataset?

@stevenwinship stevenwinship Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That happens in checkAuthorization which is called before checkGuestbookRequiredResponse

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK - fair. I'd suggest moving this down so required is just about the guestbooks and then, in your if (required) block, handle the PreviewUrlUser and Authenticated user separately with a note - PreviewUrlUsers don't need another check because they can only be downloading because they have the ViewUnpublished perm whereas authenticatedUsers who can download may have that perm or FileDownload perm, so need to distinguish those two cases here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Made a change

if (required) {
User requestor = getRequestor(user);
if (requestor instanceof AuthenticatedUser && permissionService.userOn(requestor, df.getOwner()).has(Permission.EditDataset)) {
if (user instanceof AuthenticatedUser && permissionService.userOn(user, ds).has(Permission.EditDataset)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Versus if you change here to drop the instanceof AuthenticatedUser part, this permissionService check should verify the PrivateUrlUser has an assignment on this dataset. (And this would be the perm I suggested might be ViewUnpublishedDataset to match the overall access check.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changed to ViewUnpublishedDataset

@coveralls

coveralls commented Aug 3, 2026

Copy link
Copy Markdown

Coverage Status

Coverage is 25.013%12535-download-without-guestbook-response-for-preview-user2 into develop. No base build found for develop.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Test Results

404 tests  ±0   389 ✅ ±0   37m 11s ⏱️ +11s
 55 suites ±0    15 💤 ±0 
 55 files   ±0     0 ❌ ±0 

Results for commit 43c47e1. ± Comparison against base commit e28af3f.

♻️ This comment has been updated with latest results.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@stevenwinship stevenwinship moved this from In Progress 💻 to Ready for Review ⏩ in IQSS Dataverse Project Aug 4, 2026
@stevenwinship stevenwinship removed their assignment Aug 4, 2026

@qqmyers qqmyers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Getting close - this simplifies and fixes the checkGuestbook required logic which should fix both the previewUrlUser and LFAIR issues (so this should close the LFAIR issue too).
I noted two issues to fix in other comments and added LFAIR to the release note.

private boolean isAccessApi(ContainerRequestContext containerRequestContext) {
return "GET".equalsIgnoreCase(containerRequestContext.getMethod())
&& containerRequestContext.getUriInfo() != null
&& containerRequestContext.getUriInfo().getPath().toLowerCase().startsWith("access/");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The ApiKey auth checks for the path starting with / - is that needed here too? (using final static constant as well)

public static final String ACCESS_DATAFILE_PATH_PREFIX = "/access/datafile/";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

How does that even work? The path doesn't have a leading '/'

containerRequestContext.getUriInfo().getPath() access/datafile/4|#]

@qqmyers qqmyers Aug 5, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good catch! Not sure it does - could be review/QA 0f #9303 didn't catch the problem. If you're not seeing a leading /, we are probably leaving the other APIs open to users of anonymized preview url users when we shouldn't - up to you whether you want to try fixing that here (just removing the / I think) and adding that to QA or an automated test scenario, or just reporting as a separate bug.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed SessionCookie but not ApiKeyAuth

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm looking into ApiKeyAuth separately

Comment thread src/main/java/edu/harvard/iq/dataverse/api/Access.java
@qqmyers qqmyers moved this from Ready for Review ⏩ to In Review 🔎 in IQSS Dataverse Project Aug 5, 2026
@github-actions

This comment has been minimized.

@stevenwinship
stevenwinship force-pushed the 12535-download-without-guestbook-response-for-preview-user2 branch from aaf3218 to 477ed98 Compare August 5, 2026 19:03
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@stevenwinship
stevenwinship force-pushed the 12535-download-without-guestbook-response-for-preview-user2 branch from 477ed98 to cf7d78c Compare August 5, 2026 21:09
@github-actions

This comment has been minimized.


private boolean isAccessApi(ContainerRequestContext containerRequestContext) {
String requestPath = containerRequestContext.getUriInfo() != null ? containerRequestContext.getUriInfo().getPath() : "";
return ("GET".equalsIgnoreCase(containerRequestContext.getMethod()) &&

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

At least the main Access Dataset /DownloadZip menu item calls the POST API, so PrivateURLUsers also need access to that. (Since the browser blocks other sites from sending our cookie for POST/PUT/etc. this shouldn't raise cross-site issues.)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fixed in #12479 which pulls in the commits from here.

@stevenwinship
stevenwinship force-pushed the 12535-download-without-guestbook-response-for-preview-user2 branch from 2847ea5 to c27f877 Compare August 10, 2026 20:37
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@stevenwinship
stevenwinship force-pushed the 12535-download-without-guestbook-response-for-preview-user2 branch from c27f877 to a43d3c9 Compare August 11, 2026 15:35
@github-actions

This comment has been minimized.

@stevenwinship
stevenwinship force-pushed the 12535-download-without-guestbook-response-for-preview-user2 branch from a43d3c9 to 8f06341 Compare August 11, 2026 17:19
@github-actions

This comment has been minimized.

@stevenwinship
stevenwinship force-pushed the 12535-download-without-guestbook-response-for-preview-user2 branch from 812238e to 5afc5d5 Compare August 11, 2026 18:58
@github-actions

This comment has been minimized.

@cmbz cmbz added FY27 Sprint 3 FY27 Sprint 3 (2026-07-29 - 2026-08-12) FY27 Sprint 4 FY27 Sprint 4 (2026-08-12 - 2026-08-26) labels Aug 12, 2026
@stevenwinship
stevenwinship force-pushed the 12535-download-without-guestbook-response-for-preview-user2 branch from 5afc5d5 to 43c47e1 Compare August 14, 2026 19:15
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
19.6% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@github-actions

Copy link
Copy Markdown

📦 Pushed preview images as

ghcr.io/gdcc/dataverse:12535-download-without-guestbook-response-for-preview-user2
ghcr.io/gdcc/configbaker:12535-download-without-guestbook-response-for-preview-user2

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

@jp-tosca

Copy link
Copy Markdown
Contributor

There was a comment on 8/17 that this PR #12479 could close any issues related to this one.

@landreev

Copy link
Copy Markdown
Contributor

To confirm, we were not planning to merge #12479 instead of this pr, were we? - It looks like there was more done here, since the branch was merged into GlobalDataverseCommunityConsortium:WriteMultipleGBsAtOnce.

@qqmyers

qqmyers commented Aug 17, 2026

Copy link
Copy Markdown
Member

@landreev - yes, I did suggest not merging this one. As far as I can tell, the changes after I merged are behind #12479, e.g. the changes in this commit were what I started from in working on c43acb3 and #12479 has a fix to the Filter logic that is still an open comment/request in #12584: https://github.com/IQSS/dataverse/pull/12584/changes#r3759592780 .

For QA, #12479 should be checked against the same two issues as #12584 was for, along with performance testing writing guestbookresponses for many files.

@landreev

Copy link
Copy Markdown
Contributor

If we can avoid merging this pr, that's great news. Otherwise it would be a recipe for merge conflicts (I think?) - that was the context of my question.

For QA, #12479 should be checked against the same two issues as #12584 was for, along with performance testing writing guestbookresponses for many files.

OK, I see now that #12479 closes the same 2 issues as this pr.
I'll go ahead and copy-and-paste the line from under "How to test" here into #12479 as well.

@landreev - yes, I did suggest not merging this one. As far as I can tell, the changes after I merged are behind #12479, e.g. the changes in this commit were what I started from in working on c43acb3 and #12479 has a fix to the Filter logic that is still an open comment/request in #12584: https://github.com/IQSS/dataverse/pull/12584/changes#r3759592780 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FY27 Sprint 1 FY27 Sprint 1 (2026-07-01 - 2026-07-15) FY27 Sprint 2 FY27 Sprint 2 (2026-07-15 - 2026-07-29) FY27 Sprint 3 FY27 Sprint 3 (2026-07-29 - 2026-08-12) FY27 Sprint 4 FY27 Sprint 4 (2026-08-12 - 2026-08-26) Original size: 20 Type: Bug a defect

Projects

Status: In Review 🔎

Development

Successfully merging this pull request may close these issues.

UI Downloads do not work in datasets with a locally FAIR enabled Dataverse When there is a guestbook, you cannot download files using a Preview URL

7 participants