in sonar-plugin-server/src/main/java/jetbrains/buildserver/sonarplugin/manager/ManageSQSActionController.java [88:127]
public void process(@NotNull final HttpServletRequest request,
@NotNull final HttpServletResponse response,
@Nullable final Element ajaxResponse) {
final SProject project = getProject(request);
if (ajaxResponse == null || project == null) {
return;
}
// Security test (user without management permission could access this controller)
if (!AuthUtil.hasPermissionToManageProject(securityContext.getAuthorityHolder(), project.getProjectId())){
ajaxResponse.setAttribute("error", "User has not the management permission");
return;
}
final String action = getAction(request);
try {
ConfigAction configAction = null;
if (ADD_SQS_ACTION.equals(action)) {
final SQSInfo sqsInfo = addServerInfo(request, project, ajaxResponse);
if (sqsInfo != null) {
configAction = myConfigActionFactory.createAction(project, "SonarQube Server '" + sqsInfo.getName() + "' was added");
}
} else if (REMOVE_SQS_ACTION.equals(action)) {
final SQSInfo sqsInfo = removeServerInfo(request, project, ajaxResponse);
if (sqsInfo != null) {
configAction = myConfigActionFactory.createAction(project, "SonarQube Server '" + sqsInfo.getName() + "' was removed");
}
} else if (EDIT_SQS_ACTION.equals(action)) {
final SQSInfo sqsInfo = editServerInfo(request, project, ajaxResponse);
if (sqsInfo != null) {
configAction = myConfigActionFactory.createAction(project, "parameters of SonarQube Server '" + sqsInfo.getName() + "' were changed");
}
}
if (configAction != null) {
project.persist(configAction);
}
} catch (IOException e) {
ajaxResponse.setAttribute("error", "Exception occurred: " + e.getMessage());
}
}