From 222879a9eeecc33d168ce9c2721cd0346f7c61ef Mon Sep 17 00:00:00 2001 From: "sameed.ahmad" Date: Fri, 5 Jan 2024 09:40:37 +0530 Subject: [PATCH] fix(rest): error handling when user dont have sufficient import permission Signed-off-by: sameed.ahmad --- .../sw360/rest/resourceserver/project/ProjectController.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/project/ProjectController.java b/rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/project/ProjectController.java index f8e892d9e9..c26dcdf072 100644 --- a/rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/project/ProjectController.java +++ b/rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/project/ProjectController.java @@ -1518,6 +1518,10 @@ public ResponseEntity importSBOM( if (requestSummary.getRequestStatus() == RequestStatus.FAILURE) { return new ResponseEntity(requestSummary.getMessage(), HttpStatus.BAD_REQUEST); } + else if(requestSummary.getRequestStatus() == RequestStatus.ACCESS_DENIED){ + return new ResponseEntity("You do not have sufficient permissions.", HttpStatus.UNAUTHORIZED); + } + String jsonMessage = requestSummary.getMessage(); messageMap = new Gson().fromJson(jsonMessage, Map.class); projectId = messageMap.get("projectId");