From: Teryk Bellahsene Date: Mon, 9 Oct 2017 15:02:10 +0000 (+0200) Subject: SONAR-9920 Document permissions needed for api/qualitygates WS X-Git-Tag: 6.7-RC1~304 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d78878cddfb2ec620153f14d11383b17a4315e69;p=sonarqube.git SONAR-9920 Document permissions needed for api/qualitygates WS --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CopyAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CopyAction.java index ec554a13e9c..5a31ccb33c6 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CopyAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CopyAction.java @@ -40,7 +40,8 @@ public class CopyAction implements QualityGatesWsAction { @Override public void define(WebService.NewController controller) { WebService.NewAction action = controller.createAction("copy") - .setDescription("Copy a Quality Gate. Require Administer Quality Gates permission") + .setDescription("Copy a Quality Gate.
" + + "Requires the 'Administer Quality Gates' permission.") .setPost(true) .setSince("4.3") .setHandler(this); diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateAction.java index 532361c33fc..01dc2cfa315 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateAction.java @@ -53,7 +53,8 @@ public class CreateAction implements QualityGatesWsAction { @Override public void define(WebService.NewController controller) { WebService.NewAction action = controller.createAction(ACTION_CREATE) - .setDescription("Create a Quality Gate. Require Administer Quality Gates permission") + .setDescription("Create a Quality Gate.
" + + "Requires the 'Administer Quality Gates' permission.") .setSince("4.3") .setPost(true) .setHandler(this); diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateConditionAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateConditionAction.java index d5b5d4d0622..63643947b8d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateConditionAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateConditionAction.java @@ -61,7 +61,8 @@ public class CreateConditionAction implements QualityGatesWsAction { @Override public void define(WebService.NewController controller) { WebService.NewAction createCondition = controller.createAction(ACTION_CREATE_CONDITION) - .setDescription("Add a new condition to a quality gate. Require Administer Quality Gates permission") + .setDescription("Add a new condition to a quality gate.
" + + "Requires the 'Administer Quality Gates' permission.") .setPost(true) .setSince("4.3") .setHandler(this); diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeleteConditionAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeleteConditionAction.java index afb3d91eb85..06c181b9aa4 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeleteConditionAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeleteConditionAction.java @@ -46,7 +46,7 @@ public class DeleteConditionAction implements QualityGatesWsAction { public void define(WebService.NewController controller) { WebService.NewAction createCondition = controller.createAction("delete_condition") .setDescription("Delete a condition from a quality gate.
" + - "Requires the 'Administer Quality Gates' permission") + "Requires the 'Administer Quality Gates' permission.") .setPost(true) .setSince("4.3") .setHandler(this); diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeselectAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeselectAction.java index 332afc796df..affdf16ab10 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeselectAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeselectAction.java @@ -51,7 +51,8 @@ public class DeselectAction implements QualityGatesWsAction { @Override public void define(WebService.NewController controller) { WebService.NewAction action = controller.createAction("deselect") - .setDescription("Remove the association of a project from a quality gate. Require Administer Quality Gates permission") + .setDescription("Remove the association of a project from a quality gate.
" + + "Requires the 'Administer Quality Gates' permission.") .setPost(true) .setSince("4.3") .setHandler(this) diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DestroyAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DestroyAction.java index 30ba366bc48..b068af02f1c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DestroyAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DestroyAction.java @@ -36,7 +36,8 @@ public class DestroyAction implements QualityGatesWsAction { @Override public void define(WebService.NewController controller) { WebService.NewAction action = controller.createAction("destroy") - .setDescription("Delete a Quality Gate. Require Administer Quality Gates permission") + .setDescription("Delete a Quality Gate.
" + + "Requires the 'Administer Quality Gates' permission.") .setSince("4.3") .setPost(true) .setHandler(this); diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/RenameAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/RenameAction.java index e676134c0c1..192493ad890 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/RenameAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/RenameAction.java @@ -25,7 +25,9 @@ import org.sonar.api.server.ws.WebService; import org.sonar.api.utils.text.JsonWriter; import org.sonar.db.qualitygate.QualityGateDto; import org.sonar.server.qualitygate.QualityGates; -import org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters; + +import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ID; +import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_NAME; public class RenameAction implements QualityGatesWsAction { @@ -38,17 +40,18 @@ public class RenameAction implements QualityGatesWsAction { @Override public void define(WebService.NewController controller) { WebService.NewAction action = controller.createAction("rename") - .setDescription("Rename a Quality Gate. Require Administer Quality Gates permission") + .setDescription("Rename a Quality Gate.
" + + "Requires the 'Administer Quality Gates' permission.") .setSince("4.3") .setPost(true) .setHandler(this); - action.createParam(QualityGatesWsParameters.PARAM_ID) + action.createParam(PARAM_ID) .setDescription("ID of the quality gate to rename") .setRequired(true) .setExampleValue("1"); - action.createParam(QualityGatesWsParameters.PARAM_NAME) + action.createParam(PARAM_NAME) .setDescription("New name of the quality gate") .setRequired(true) .setExampleValue("My Quality Gate"); @@ -56,8 +59,8 @@ public class RenameAction implements QualityGatesWsAction { @Override public void handle(Request request, Response response) { - long idToRename = QualityGatesWs.parseId(request, QualityGatesWsParameters.PARAM_ID); - QualityGateDto renamedQualityGate = qualityGates.rename(idToRename, request.mandatoryParam(QualityGatesWsParameters.PARAM_NAME)); + long idToRename = QualityGatesWs.parseId(request, PARAM_ID); + QualityGateDto renamedQualityGate = qualityGates.rename(idToRename, request.mandatoryParam(PARAM_NAME)); JsonWriter writer = response.newJsonWriter(); QualityGatesWs.writeQualityGate(renamedQualityGate, writer).close(); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SelectAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SelectAction.java index a1d0db5ba78..4df3158c513 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SelectAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SelectAction.java @@ -62,7 +62,7 @@ public class SelectAction implements QualityGatesWsAction { .setDescription("Associate a project to a quality gate.
" + "The '%s' or '%s' must be provided.
" + "Project id as a numeric value is deprecated since 6.1. Please use the id similar to '%s'.
" + - "Require Administer Quality Gates permission.", + "Requires the 'Administer Quality Gates' permission.", PARAM_PROJECT_ID, PARAM_PROJECT_KEY, Uuids.UUID_EXAMPLE_02) .setPost(true) diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SetAsDefaultAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SetAsDefaultAction.java index 221b96fe2b3..f9841353ec9 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SetAsDefaultAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SetAsDefaultAction.java @@ -36,7 +36,8 @@ public class SetAsDefaultAction implements QualityGatesWsAction { @Override public void define(WebService.NewController controller) { WebService.NewAction action = controller.createAction("set_as_default") - .setDescription("Set a quality gate as the default quality gate. Require Administer Quality Gates permission") + .setDescription("Set a quality gate as the default quality gate.
" + + "Requires the 'Administer Quality Gates' permission.") .setSince("4.3") .setPost(true) .setHandler(this); diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UnsetDefaultAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UnsetDefaultAction.java index 43bef1d7f74..9daf27fb677 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UnsetDefaultAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UnsetDefaultAction.java @@ -36,7 +36,8 @@ public class UnsetDefaultAction implements QualityGatesWsAction { @Override public void define(WebService.NewController controller) { WebService.NewAction action = controller.createAction("unset_default") - .setDescription("Unset a quality gate as the default quality gate. Require Administer Quality Gates permission") + .setDescription("Unset a quality gate as the default quality gate.
" + + "Requires the 'Administer Quality Gates' permission.") .setSince("4.3") .setPost(true) .setHandler(this); diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UpdateConditionAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UpdateConditionAction.java index 122aaea9cc5..9fb2035f2d6 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UpdateConditionAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UpdateConditionAction.java @@ -61,7 +61,8 @@ public class UpdateConditionAction implements QualityGatesWsAction { @Override public void define(WebService.NewController controller) { WebService.NewAction createCondition = controller.createAction(ACTION_UPDATE_CONDITION) - .setDescription("Update a condition attached to a quality gate. Require Administer Quality Gates permission") + .setDescription("Update a condition attached to a quality gate.
" + + "Requires the 'Administer Quality Gates' permission.") .setPost(true) .setSince("4.3") .setHandler(this);