Skip to content

Commit a33728d

Browse files
committed
add release note
1 parent 86bb6d0 commit a33728d

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Bug / Not Bug in Dataverse. Bug is in SPA Frontend
2+
3+
Cleaned up Access APIs to localize getting user from session for JSF backward compatibility
4+
5+
This bug requires a front end fix to send the Bearer Token in the API call.
6+
7+
See: #11740

src/main/java/edu/harvard/iq/dataverse/api/Access.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public BundleDownloadInstance datafileBundle(@Context ContainerRequestContext cr
189189

190190
if (gbrecs != true && df.isReleased()){
191191
// Write Guestbook record if not done previously and file is released
192-
gbr = guestbookResponseService.initAPIGuestbookResponse(df.getOwner(), df, session, getUser(crc));
192+
gbr = guestbookResponseService.initAPIGuestbookResponse(df.getOwner(), df, session, getRequestor(crc));
193193
guestbookResponseService.save(gbr);
194194
MakeDataCountEntry entry = new MakeDataCountEntry(uriInfo, headers, dvRequestService, df);
195195
mdcLogService.logEntry(entry);
@@ -285,7 +285,7 @@ public Response datafile(@Context ContainerRequestContext crc, @PathParam("fileI
285285

286286
if (gbrecs != true && df.isReleased()){
287287
// Write Guestbook record if not done previously and file is released
288-
gbr = guestbookResponseService.initAPIGuestbookResponse(df.getOwner(), df, session, getUser(crc));
288+
gbr = guestbookResponseService.initAPIGuestbookResponse(df.getOwner(), df, session, getRequestor(crc));
289289
}
290290

291291
DownloadInfo dInfo = new DownloadInfo(df);
@@ -798,7 +798,7 @@ private Response downloadDatafiles(ContainerRequestContext crc, String rawFileId
798798
String customZipServiceUrl = settingsService.getValueForKey(SettingsServiceBean.Key.CustomZipDownloadServiceUrl);
799799
boolean useCustomZipService = customZipServiceUrl != null;
800800

801-
User user = getUser(crc);
801+
User user = getRequestor(crc);
802802

803803
Boolean getOrig = false;
804804
for (String key : uriInfo.getQueryParameters().keySet()) {
@@ -1733,12 +1733,12 @@ public Response getUserPermissionsOnFile(@Context ContainerRequestContext crc, @
17331733
// checkAuthorization is a convenience method; it calls the boolean method
17341734
// isAccessAuthorized(), the actual workhorse, and throws a 403 exception if not.
17351735
private void checkAuthorization(ContainerRequestContext crc, DataFile df) throws WebApplicationException {
1736-
User user = getUser(crc);
1736+
User user = getRequestor(crc);
17371737
if (!isAccessAuthorized(user, df)) {
17381738
throw new ForbiddenException();
17391739
}
17401740
}
1741-
private User getUser(ContainerRequestContext crc) {
1741+
private User getRequestor(ContainerRequestContext crc) {
17421742
User user = getRequestUser(crc);
17431743
// CompoundAuthMechanism should find the user by API Key/Token, Workflow, etc. And for SPA the Bearer Token
17441744
// For JSF check if CompoundAuthMechanism couldn't find the user then try to get it from the session

0 commit comments

Comments
 (0)