in commit-status-publisher-server/src/main/java/jetbrains/buildServer/commitPublisher/upsource/UpsourceSettings.java [184:204]
public void processResponse(HttpHelper.HttpResponse response) throws HttpPublisherException, IOException {
super.processResponse(response);
final String json = response.getContent();
if (null == json) {
throw new HttpPublisherException("Upsource publisher has received no response");
}
UpsourceGetCurrentUserResult result = myGson.fromJson(json, UpsourceGetCurrentUserResult.class);
if (null == result || null == result.result || null == result.result.userId) {
throw new HttpPublisherException("Upsource publisher has received a malformed response");
}
UpsourceCurrentUser user = result.result;
if (null != user.adminPermissionsInProjects) {
for (String prjId : user.adminPermissionsInProjects) {
if (prjId.equals(myProjectId)) {
return;
}
}
}
throw new HttpPublisherException("Upsource does not grant enough permissions to publish a commit status");
}