Skip to content

Commit 6d313fb

Browse files
authored
Merge pull request #125 from diging/develop
[GECO-148] Giles uses progress id for checking on uploaded files
2 parents 47fc0a3 + 9457a98 commit 6d313fb

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

giles-eco/src/main/java/edu/asu/diging/gilesecosystem/web/api/v2/V2FilesController.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,13 @@ public ResponseEntity<String> getFile(@PathVariable String fileId,
208208
return new ResponseEntity<String>(HttpStatus.NOT_FOUND);
209209
}
210210

211-
212-
if (!citesphereConnector.hasAccess(file.getDocumentId(), ((CitesphereUser)citesphereToken.getPrincipal()).getUsername())) {
211+
/*
212+
* Citesphere does not have the document id until Giles is done processing. Also, if there
213+
* is an issue and Citesphere never updates the status of the uploaded file, it doesn't have
214+
* the document id either. So we send the progress id here.
215+
*/
216+
IUpload upload = uploadService.getUpload(file.getUploadId());
217+
if (!citesphereConnector.hasAccessViaProgressId(upload.getUploadProgressId(), ((CitesphereUser)citesphereToken.getPrincipal()).getUsername())) {
213218
return new ResponseEntity<String>(HttpStatus.FORBIDDEN);
214219
}
215220

giles-eco/src/main/java/edu/asu/diging/gilesecosystem/web/core/service/upload/impl/UploadService.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ public UploadIds startUpload(DocumentAccess access, DocumentType type,
6161
return ids;
6262
}
6363

64+
/**
65+
* Get a list of statuses for each file uploaded in an upload identified by its
66+
* progress id.
67+
*
68+
* @param id Progress id of upload to check.
69+
*/
6470
@Override
6571
public List<StorageStatus> getUploadStatus(String id) {
6672
List<StorageStatus> statuses = new ArrayList<>();

0 commit comments

Comments
 (0)