in src/main/java/com/googlesource/gerrit/plugins/serviceuser/GetServiceUser.java [59:91]
public Response<ServiceUserInfo> apply(ServiceUserResource rsrc)
throws IOException, RestApiException, PermissionBackendException {
String username = rsrc.getUser().getUserName().get();
Config db = storageCache.get();
if (!db.getSubsections(USER).contains(username)) {
throw new ResourceNotFoundException(username);
}
ServiceUserInfo info;
try {
info = new ServiceUserInfo(getAccount.get().apply(rsrc).value());
} catch (Exception e) {
throw asRestApiException("Cannot get service user", e);
}
AccountLoader al = accountLoader.create(true);
info.createdBy = al.get(Account.id(db.getInt(USER, username, KEY_CREATOR_ID, -1)));
al.fill();
info.createdAt = db.getString(USER, username, KEY_CREATED_AT);
info.inactive = !rsrc.getUser().getAccount().isActive() ? true : null;
Response<GroupInfo> response = getOwner.apply(rsrc);
if (response.statusCode() == SC_OK) {
try {
info.owner = response.value();
} catch (Exception e) {
throw asRestApiException("Cannot get owner", e);
}
}
return Response.ok(info);
}