From ee220ca0f2a3bfaa8b5e05ef6c84ebfcd5cd8258 Mon Sep 17 00:00:00 2001 From: Leonid Andreev Date: Fri, 31 Mar 2023 17:48:58 -0400 Subject: [PATCH 1/2] fixes previewer access to files in deaccessioned datasets. #9455 --- src/main/java/edu/harvard/iq/dataverse/FilePage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/FilePage.java b/src/main/java/edu/harvard/iq/dataverse/FilePage.java index 0c15aba852b..e6d5cc75ca3 100644 --- a/src/main/java/edu/harvard/iq/dataverse/FilePage.java +++ b/src/main/java/edu/harvard/iq/dataverse/FilePage.java @@ -996,7 +996,7 @@ public void setSelectedTool(ExternalTool selectedTool) { public String preview(ExternalTool externalTool) { ApiToken apiToken = null; User user = session.getUser(); - if (fileMetadata.getDatasetVersion().isDraft() || (fileMetadata.getDataFile().isRestricted()) || (FileUtil.isActivelyEmbargoed(fileMetadata))) { + if (fileMetadata.getDatasetVersion().isDraft() || fileMetadata.getDatasetVersion().isDeaccessioned() || (fileMetadata.getDataFile().isRestricted()) || (FileUtil.isActivelyEmbargoed(fileMetadata))) { apiToken=fileDownloadService.getApiToken(user); } if(externalTool == null){ From ee1311f77921fc6bda0c7fae3ff290affed77420 Mon Sep 17 00:00:00 2001 From: Leonid Andreev Date: Tue, 4 Apr 2023 14:52:08 -0400 Subject: [PATCH 2/2] same, but for the "open in new window" case. #9455 --- .../java/edu/harvard/iq/dataverse/FileDownloadServiceBean.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/FileDownloadServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/FileDownloadServiceBean.java index 65e6b259bf4..d0e9b085acf 100644 --- a/src/main/java/edu/harvard/iq/dataverse/FileDownloadServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/FileDownloadServiceBean.java @@ -299,7 +299,7 @@ public void explore(GuestbookResponse guestbookResponse, FileMetadata fmd, Exter ApiToken apiToken = null; User user = session.getUser(); DatasetVersion version = fmd.getDatasetVersion(); - if (version.isDraft() || (fmd.getDataFile().isRestricted()) || (FileUtil.isActivelyEmbargoed(fmd))) { + if (version.isDraft() || fmd.getDatasetVersion().isDeaccessioned() || (fmd.getDataFile().isRestricted()) || (FileUtil.isActivelyEmbargoed(fmd))) { apiToken = getApiToken(user); } DataFile dataFile = null;