if (username.equals(currentUser.getName())) {
return currentUser;
}
// a different user was requested, go and fetch it from the server
try {
final UserResponse response = api.path(resource.get(username), UserResponse.class).execute();
// TODO this user is not cached locally for now. we should be tracking REST requests.
// TODO we cache the user for this request, but only for checking permissions. this needs to be cleaned up after 0.20.0
final User user = userFactory.fromResponse(response, null);
Http.Context.current().args.put("perRequestUsersCache:" + user.getName(), user);
return user;