aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Jambet <guillaume.jambet@sonarsource.com>2017-12-08 16:26:56 +0100
committerGuillaume Jambet <guillaume.jambet@gmail.com>2017-12-21 09:19:48 +0100
commit22ce45998c5aade093111d42893f8fa071dae96a (patch)
treed89610a28858b0aa445c53c674bef87179a64861
parentca4ebe4ed24ce95ab556e45d25ab4933f27dfd2f (diff)
downloadsonarqube-22ce45998c5aade093111d42893f8fa071dae96a.tar.gz
sonarqube-22ce45998c5aade093111d42893f8fa071dae96a.zip
SONAR-10181 Aligning TemplateGroupAction behavior and documentation
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionsWsParametersBuilder.java10
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/TemplateGroupsAction.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/permission/ws/PermissionsWsTest.java1
3 files changed, 8 insertions, 5 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionsWsParametersBuilder.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionsWsParametersBuilder.java
index ebc2956e146..3c12d7f0e5d 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionsWsParametersBuilder.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionsWsParametersBuilder.java
@@ -49,7 +49,7 @@ public class PermissionsWsParametersBuilder {
"</ul>",
GlobalPermissions.ALL_ON_ONE_LINE,
ProjectPermissions.ALL_ON_ONE_LINE);
- private static final String PROJECT_PERMISSION_PARAM_DESCRIPTION = format("Permission" +
+ public static final String PROJECT_PERMISSION_PARAM_DESCRIPTION = format("Permission" +
"<ul>" +
"<li>Possible values for project permissions %s</li>" +
"</ul>",
@@ -65,11 +65,15 @@ public class PermissionsWsParametersBuilder {
.setRequired(true);
}
- public static NewParam createProjectPermissionParameter(NewAction action) {
+ public static NewParam createProjectPermissionParameter(NewAction action, boolean required) {
return action.createParam(PARAM_PERMISSION)
.setDescription(PROJECT_PERMISSION_PARAM_DESCRIPTION)
.setPossibleValues(ProjectPermissions.ALL)
- .setRequired(true);
+ .setRequired(required);
+ }
+
+ public static NewParam createProjectPermissionParameter(NewAction action) {
+ return createProjectPermissionParameter(action, true);
}
public static void createGroupNameParameter(NewAction action) {
diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/TemplateGroupsAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/TemplateGroupsAction.java
index ab2ec105106..cac5eea701c 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/TemplateGroupsAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/TemplateGroupsAction.java
@@ -83,7 +83,7 @@ public class TemplateGroupsAction implements PermissionsWsAction {
"When this parameter is not set, only group having at least one permission are returned.")
.setExampleValue("eri");
- createProjectPermissionParameter(action);
+ createProjectPermissionParameter(action, false);
createTemplateParameters(action);
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/PermissionsWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/PermissionsWsTest.java
index e3675357ce8..b3afa0bf7f5 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/PermissionsWsTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/PermissionsWsTest.java
@@ -76,7 +76,6 @@ public class PermissionsWsTest {
assertThat(action.isPost()).isFalse();
assertThat(action.isInternal()).isTrue();
assertThat(action.since()).isEqualTo("5.2");
- assertThat(action.param(PARAM_PERMISSION).isRequired()).isTrue();
}
private WebService.Controller controller() {