aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-11-12 17:08:52 +0100
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-11-17 13:41:01 +0100
commitf0f35839eba2256b1166b21f683c1cba67eef6be (patch)
treef73dbf54319393eb7a3f71bb5b71c03dc12198ec /sonar-ws
parenta000d18795598ee8c666dc7b90aa57eb3904bdd1 (diff)
downloadsonarqube-f0f35839eba2256b1166b21f683c1cba67eef6be.tar.gz
sonarqube-f0f35839eba2256b1166b21f683c1cba67eef6be.zip
SONAR-6947 api/permissions/remove_user use RemoveUserWsRequest
Diffstat (limited to 'sonar-ws')
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsWsClient.java8
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserWsRequest.java72
2 files changed, 80 insertions, 0 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsWsClient.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsWsClient.java
index f8844c287e0..cd0b590fecb 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsWsClient.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsWsClient.java
@@ -132,6 +132,14 @@ public class PermissionsWsClient {
.setParam(PARAM_TEMPLATE_NAME, request.getTemplateName()));
}
+ public void removeUser(RemoveUserWsRequest request) {
+ wsClient.execute(newPostRequest(action("remove_user"))
+ .setParam(PARAM_PERMISSION, request.getPermission())
+ .setParam(PARAM_USER_LOGIN, request.getLogin())
+ .setParam(PARAM_PROJECT_ID, request.getProjectId())
+ .setParam(PARAM_PROJECT_KEY, request.getProjectKey()));
+ }
+
private static String action(String action) {
return PermissionsWsParameters.ENDPOINT + "/" + action;
}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserWsRequest.java
new file mode 100644
index 00000000000..342021b413b
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserWsRequest.java
@@ -0,0 +1,72 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.sonarqube.ws.client.permission;
+
+import javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
+
+import static java.util.Objects.requireNonNull;
+
+public class RemoveUserWsRequest {
+ private String permission;
+ private String login;
+ private String projectId;
+ private String projectKey;
+
+ public String getPermission() {
+ return permission;
+ }
+
+ public RemoveUserWsRequest setPermission(String permission) {
+ this.permission = requireNonNull(permission);
+ return this;
+ }
+
+ @CheckForNull
+ public String getLogin() {
+ return login;
+ }
+
+ public RemoveUserWsRequest setLogin(@Nullable String login) {
+ this.login = login;
+ return this;
+ }
+
+ @CheckForNull
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public RemoveUserWsRequest setProjectId(@Nullable String projectId) {
+ this.projectId = projectId;
+ return this;
+ }
+
+ @CheckForNull
+ public String getProjectKey() {
+ return projectKey;
+ }
+
+ public RemoveUserWsRequest setProjectKey(@Nullable String projectKey) {
+ this.projectKey = projectKey;
+ return this;
+ }
+}