use of org.graylog2.rest.models.users.responses.UserSummary in project graylog2-server by Graylog2.
the class UsersResource method getbyId.
@GET
@Path("id/{userId}")
@ApiOperation(value = "Get user details by userId", notes = "The user's permissions are only included if a user asks for his " + "own account or for users with the necessary permissions to edit permissions.")
@ApiResponses({ @ApiResponse(code = 404, message = "The user could not be found.") })
public UserSummary getbyId(@ApiParam(name = "userId", value = "The userId to return information for.", required = true) @PathParam("userId") String userId, @Context UserContext userContext) {
final User user = loadUserById(userId);
final String username = user.getName();
// Reader users always have permissions to edit their own profile.
if (!isPermitted(USERS_EDIT, username)) {
throw new ForbiddenException("Not allowed to view userId " + userId);
}
return returnSummary(userContext, user);
}
Aggregations