Skip to content

Commit

Permalink
Merge pull request #3210 from keeps/alindo-dev-listUsersAccesskeys
Browse files Browse the repository at this point in the history
edited get acces key list
  • Loading branch information
hmiguim authored May 28, 2024
2 parents b7452ea + 8064a26 commit ab620d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,14 @@ public AccessKeys getAccessKeysByUser(String username) {

try {
controllerAssistant.checkRoles(requestContext.getUser());
return RodaCoreFactory.getModelService().listAccessKeysByUser(username);
if (membersService.retrieveUser(username).getId() == null) {
throw new NotFoundException("User not found");
}
AccessKeys accessKeys = RodaCoreFactory.getModelService().listAccessKeysByUser(username);
for (AccessKey accessKey : accessKeys.getObjects()){
accessKey.setKey(null);
}
return accessKeys;
} catch (RODAException e) {
state = LogEntryState.FAILURE;
throw new RESTException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ Void deleteUserAccessKeys(
Void deleteAccessKey(
@Parameter(description = "The access key id ") @PathVariable(name = RodaConstants.API_PATH_PARAM_NAME) String accessKeyId);

@RequestMapping(path = "/users/accesskey/list/{" + RodaConstants.API_PATH_PARAM_NAME
+ "}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(path = "/users/{" + RodaConstants.API_PATH_PARAM_NAME
+ "}/access-keys", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "Get user access keys list", description = "Gets a particular user access keys", responses = {
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AccessKeys.class))),
@ApiResponse(responseCode = "404", description = "Not found", content = @Content(schema = @Schema(implementation = ErrorResponseMessage.class)))})
Expand Down

0 comments on commit ab620d3

Please sign in to comment.