]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9920 Document permissions needed for api/qualitygates WS
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Mon, 9 Oct 2017 15:02:10 +0000 (17:02 +0200)
committerTeryk Bellahsene <teryk@users.noreply.github.com>
Wed, 11 Oct 2017 16:04:40 +0000 (18:04 +0200)
server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CopyAction.java
server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateAction.java
server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateConditionAction.java
server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeleteConditionAction.java
server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeselectAction.java
server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DestroyAction.java
server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/RenameAction.java
server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SelectAction.java
server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SetAsDefaultAction.java
server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UnsetDefaultAction.java
server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UpdateConditionAction.java

index ec554a13e9c520a456740bb6f51ab3570007b1c3..5a31ccb33c6e3fe6aca595a78fb989282f5eec63 100644 (file)
@@ -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.<br>" +
+        "Requires the 'Administer Quality Gates' permission.")
       .setPost(true)
       .setSince("4.3")
       .setHandler(this);
index 532361c33fce2bd458a7a3da50859fa6d4bdf12c..01dc2cfa315ddeb51b8131137832dc9994933504 100644 (file)
@@ -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.<br>" +
+        "Requires the 'Administer Quality Gates' permission.")
       .setSince("4.3")
       .setPost(true)
       .setHandler(this);
index d5b5d4d0622d0170c00e7a33c19009c8e9f6f95a..63643947b8d4b8c3d0a1bda497ac5b5229c3bde4 100644 (file)
@@ -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.<br>" +
+        "Requires the 'Administer Quality Gates' permission.")
       .setPost(true)
       .setSince("4.3")
       .setHandler(this);
index afb3d91eb8554639b145daa14ff0184abf226074..06c181b9aa45976a5cbb64835fb52aa9abb4eb4e 100644 (file)
@@ -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.<br>" +
-        "Requires the 'Administer Quality Gates' permission")
+        "Requires the 'Administer Quality Gates' permission.")
       .setPost(true)
       .setSince("4.3")
       .setHandler(this);
index 332afc796df1ec96bc1c7d6e6c5cdae5475a7588..affdf16ab103ed55835b0e4e2223db43c86616c0 100644 (file)
@@ -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.<br>" +
+        "Requires the 'Administer Quality Gates' permission.")
       .setPost(true)
       .setSince("4.3")
       .setHandler(this)
index 30ba366bc48a0a71bba1751a365120824ae3a4c9..b068af02f1caad1306659e233041e8f941765003 100644 (file)
@@ -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.<br>" +
+        "Requires the 'Administer Quality Gates' permission.")
       .setSince("4.3")
       .setPost(true)
       .setHandler(this);
index e676134c0c16e44a15bb38b69710a41919f35335..192493ad890f353e409e9c86805d44dec56be352 100644 (file)
@@ -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.<br>" +
+        "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();
   }
index a1d0db5ba7819cbab63a8075d898c7becf88514d..4df3158c51342e88e3b79e9959b6c1e1b010a290 100644 (file)
@@ -62,7 +62,7 @@ public class SelectAction implements QualityGatesWsAction {
       .setDescription("Associate a project to a quality gate.<br>" +
         "The '%s' or '%s' must be provided.<br>" +
         "Project id as a numeric value is deprecated since 6.1. Please use the id similar to '%s'.<br>" +
-        "Require Administer Quality Gates permission.",
+          "Requires the 'Administer Quality Gates' permission.",
         PARAM_PROJECT_ID, PARAM_PROJECT_KEY,
         Uuids.UUID_EXAMPLE_02)
       .setPost(true)
index 221b96fe2b3e84050b55cf10d462ff50e016e1ca..f9841353ec9bf6a53ca59cddb2f0efad44840653 100644 (file)
@@ -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.<br>" +
+        "Requires the 'Administer Quality Gates' permission.")
       .setSince("4.3")
       .setPost(true)
       .setHandler(this);
index 43bef1d7f74fad9ea14f5300013023195ae46a93..9daf27fb6779b5fad494710251a3a298512be8d3 100644 (file)
@@ -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.<br>" +
+        "Requires the 'Administer Quality Gates' permission.")
       .setSince("4.3")
       .setPost(true)
       .setHandler(this);
index 122aaea9cc51a398278e58f66d0e9dbac8109c6d..9fb2035f2d66ab1b1ea90f39e0716ce5ab4919d2 100644 (file)
@@ -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.<br>" +
+        "Requires the 'Administer Quality Gates' permission.")
       .setPost(true)
       .setSince("4.3")
       .setHandler(this);