aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws/src/main
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-11-12 17:19:38 +0100
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-11-17 13:41:02 +0100
commit3682b11b6704b11688bdf435159c7f8eb651e03c (patch)
tree1dbb341bca58e60ad7f87ee5f49d59a537bc3550 /sonar-ws/src/main
parentf0f35839eba2256b1166b21f683c1cba67eef6be (diff)
downloadsonarqube-3682b11b6704b11688bdf435159c7f8eb651e03c.tar.gz
sonarqube-3682b11b6704b11688bdf435159c7f8eb651e03c.zip
SONAR-6947 api/permissions/remove_user_from_template use RemoveUserFromTemplateWsRequest
Diffstat (limited to 'sonar-ws/src/main')
-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/RemoveUserFromTemplateWsRequest.java71
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserWsRequest.java5
3 files changed, 81 insertions, 3 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 cd0b590fecb..7988dce7689 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
@@ -140,6 +140,14 @@ public class PermissionsWsClient {
.setParam(PARAM_PROJECT_KEY, request.getProjectKey()));
}
+ public void removeUserFromTemplate(RemoveUserFromTemplateWsRequest request) {
+ wsClient.execute(newPostRequest(action("remove_user_from_template"))
+ .setParam(PARAM_PERMISSION, request.getPermission())
+ .setParam(PARAM_USER_LOGIN, request.getLogin())
+ .setParam(PARAM_TEMPLATE_ID, request.getTemplateId())
+ .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName()));
+ }
+
private static String action(String action) {
return PermissionsWsParameters.ENDPOINT + "/" + action;
}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserFromTemplateWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserFromTemplateWsRequest.java
new file mode 100644
index 00000000000..a1829e9adb1
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserFromTemplateWsRequest.java
@@ -0,0 +1,71 @@
+/*
+ * 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 RemoveUserFromTemplateWsRequest {
+ private String login;
+ private String permission;
+ private String templateId;
+ private String templateName;
+
+ public String getLogin() {
+ return login;
+ }
+
+ public RemoveUserFromTemplateWsRequest setLogin(String login) {
+ this.login = requireNonNull(login);
+ return this;
+ }
+
+ public String getPermission() {
+ return permission;
+ }
+
+ public RemoveUserFromTemplateWsRequest setPermission(String permission) {
+ this.permission = requireNonNull(permission);
+ return this;
+ }
+
+ @CheckForNull
+ public String getTemplateId() {
+ return templateId;
+ }
+
+ public RemoveUserFromTemplateWsRequest setTemplateId(@Nullable String templateId) {
+ this.templateId = templateId;
+ return this;
+ }
+
+ @CheckForNull
+ public String getTemplateName() {
+ return templateName;
+ }
+
+ public RemoveUserFromTemplateWsRequest setTemplateName(@Nullable String templateName) {
+ this.templateName = templateName;
+ return this;
+ }
+}
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
index 342021b413b..7766cf5233d 100644
--- 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
@@ -40,13 +40,12 @@ public class RemoveUserWsRequest {
return this;
}
- @CheckForNull
public String getLogin() {
return login;
}
- public RemoveUserWsRequest setLogin(@Nullable String login) {
- this.login = login;
+ public RemoveUserWsRequest setLogin(String login) {
+ this.login = requireNonNull(login);
return this;
}