Skip to content

Commit

Permalink
Add some more changes.
Browse files Browse the repository at this point in the history
Signed-off-by: AAJELLAL <[email protected]>
  • Loading branch information
AAJELLAL committed May 28, 2024
1 parent 2d0aed8 commit 6284724
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,11 @@ public void areDirectoryElementsDeletable(List<UUID> elementUuids, String userId
.queryParam(PARAM_IDS, ids)
.buildAndExpand()
.toUriString();

ResponseEntity<Void> response;
try {
restTemplate.exchange(directoryServerBaseUri + path, HttpMethod.HEAD, new HttpEntity<>(headers), Void.class);
response = restTemplate.exchange(directoryServerBaseUri + path, HttpMethod.HEAD, new HttpEntity<>(headers), Void.class);

} catch (HttpStatusCodeException e) {
if (HttpStatus.FORBIDDEN.equals(e.getStatusCode())) {
throw new ExploreException(NOT_ALLOWED);
Expand All @@ -138,6 +141,10 @@ public void areDirectoryElementsDeletable(List<UUID> elementUuids, String userId
throw e;
}
}

if (HttpStatus.NO_CONTENT.equals(response.getStatusCode())) {
throw new ExploreException(NOT_ALLOWED);
}
}

public void deleteElementsFromDirectory(List<UUID> elementUuids, UUID parentDirectoryUuid, String userId) {
Expand Down

0 comments on commit 6284724

Please sign in to comment.