Skip to content

Commit

Permalink
fix(rest): error handling when user dont have sufficient import permi…
Browse files Browse the repository at this point in the history
…ssion

Signed-off-by: sameed.ahmad <sameed.ahmad@siemens-healthineers.com>
  • Loading branch information
sameed20 committed Jan 5, 2024
1 parent 89a75f8 commit 222879a
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1518,6 +1518,10 @@ public ResponseEntity<?> importSBOM(
if (requestSummary.getRequestStatus() == RequestStatus.FAILURE) {
return new ResponseEntity<String>(requestSummary.getMessage(), HttpStatus.BAD_REQUEST);
}
else if(requestSummary.getRequestStatus() == RequestStatus.ACCESS_DENIED){
return new ResponseEntity<String>("You do not have sufficient permissions.", HttpStatus.UNAUTHORIZED);
}

String jsonMessage = requestSummary.getMessage();
messageMap = new Gson().fromJson(jsonMessage, Map.class);
projectId = messageMap.get("projectId");
Expand Down

0 comments on commit 222879a

Please sign in to comment.