aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-10-06 08:20:28 +0200
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-10-06 08:20:28 +0200
commit93a3a34b9f09111b4f0d845dab4b1e6de6cd87f4 (patch)
tree737e97fcb289d66bce534e298fb0df8e85c5f590
parent266d66ca1c06150d058f48910990d7891f66f6c4 (diff)
downloadsonarqube-93a3a34b9f09111b4f0d845dab4b1e6de6cd87f4.tar.gz
sonarqube-93a3a34b9f09111b4f0d845dab4b1e6de6cd87f4.zip
SONAR-6784 Remove RoR WS from Permissions declaration
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionsWs.java58
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/permission/ws/PermissionsWsTest.java23
2 files changed, 1 insertions, 80 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionsWs.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionsWs.java
index 932740d4748..a106538f562 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionsWs.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionsWs.java
@@ -20,12 +20,7 @@
package org.sonar.server.permission.ws;
-import com.google.common.collect.ImmutableSet;
-import org.sonar.api.security.DefaultGroups;
-import org.sonar.api.server.ws.RailsHandler;
import org.sonar.api.server.ws.WebService;
-import org.sonar.core.permission.GlobalPermissions;
-import org.sonar.core.permission.ProjectPermissions;
public class PermissionsWs implements WebService {
@@ -47,59 +42,6 @@ public class PermissionsWs implements WebService {
action.define(controller);
}
- defineAddAction(controller);
- defineRemoveAction(controller);
-
controller.done();
}
-
- private static void defineAddAction(NewController controller) {
- NewAction action = controller.createAction("add")
- .setDescription("Add a global or a project permission. Requires Administer System permission for global permissions, " +
- "requires Administer permission on project for project permissions")
- .setSince("3.7")
- .setPost(true)
- .setHandler(RailsHandler.INSTANCE);
- action.createParam("permission")
- .setDescription("Key of the permission to add")
- .setRequired(true)
- .setPossibleValues(ImmutableSet.<String>builder().addAll(GlobalPermissions.ALL).addAll(ProjectPermissions.ALL).build())
- .setExampleValue("shareDashboard");
- action.createParam("user")
- .setDescription("User login. Required if group is not set")
- .setExampleValue("myuser");
- action.createParam("group")
- .setDescription("Group name or \"" + DefaultGroups.ANYONE + "\". Required if user is not set")
- .setExampleValue(DefaultGroups.ADMINISTRATORS);
- action.createParam("component")
- .setDescription("Key of the project. Required if a project permission is set. Available since version 4.0")
- .setExampleValue("org.codehaus.sonar");
- RailsHandler.addFormatParam(action);
- }
-
- private static void defineRemoveAction(NewController controller) {
- NewAction action = controller.createAction("remove")
- .setDescription("Remove a global or a project permission. Requires Administer System permission for global permissions, " +
- "requires Administer permission on project for project permissions")
- .setSince("3.7")
- .setPost(true)
- .setHandler(RailsHandler.INSTANCE);
-
- action.createParam("permission")
- .setDescription("Key of the permission to remove")
- .setRequired(true)
- .setPossibleValues(ImmutableSet.<String>builder().addAll(GlobalPermissions.ALL).addAll(ProjectPermissions.ALL).build())
- .setExampleValue("shareDashboard");
- action.createParam("user")
- .setDescription("User login. Required if group is not set")
- .setExampleValue("myuser");
- action.createParam("group")
- .setDescription("Group name or \"" + DefaultGroups.ANYONE + "\". Required if user is not set")
- .setExampleValue(DefaultGroups.ADMINISTRATORS);
- action.createParam("component")
- .setDescription("Key of the project. Required if a project permission is set. Available since version 4.0")
- .setExampleValue("org.codehaus.sonar");
- RailsHandler.addFormatParam(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 f8e8932e28c..05d459db6d6 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
@@ -22,7 +22,6 @@ package org.sonar.server.permission.ws;
import org.junit.Before;
import org.junit.Test;
-import org.sonar.api.server.ws.RailsHandler;
import org.sonar.api.server.ws.WebService;
import org.sonar.db.DbClient;
import org.sonar.server.user.UserSession;
@@ -53,27 +52,7 @@ public class PermissionsWsTest {
assertThat(controller).isNotNull();
assertThat(controller.description()).isNotEmpty();
assertThat(controller.since()).isEqualTo("3.7");
- assertThat(controller.actions()).hasSize(4);
- }
-
- @Test
- public void define_add_action() {
- WebService.Action action = controller().action("add");
- assertThat(action).isNotNull();
- assertThat(action.handler()).isInstanceOf(RailsHandler.INSTANCE.getClass());
- assertThat(action.params()).hasSize(5);
-
- WebService.Param permission = action.param("permission");
- assertThat(permission).isNotNull();
- assertThat(permission.possibleValues()).hasSize(9);
- }
-
- @Test
- public void define_remove_action() {
- WebService.Action action = controller().action("remove");
- assertThat(action).isNotNull();
- assertThat(action.handler()).isInstanceOf(RailsHandler.INSTANCE.getClass());
- assertThat(action.params()).hasSize(5);
+ assertThat(controller.actions()).hasSize(2);
}
@Test