diff options
Diffstat (limited to 'sonar-ws')
3 files changed, 93 insertions, 1 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 88e0474cf7a..d79ff4e6568 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 @@ -22,6 +22,7 @@ package org.sonarqube.ws.client.permission; import org.sonarqube.ws.WsPermissions; import org.sonarqube.ws.WsPermissions.CreateTemplateWsResponse; +import org.sonarqube.ws.WsPermissions.SearchProjectPermissionsWsResponse; import org.sonarqube.ws.WsPermissions.WsSearchGlobalPermissionsResponse; import org.sonarqube.ws.client.WsClient; @@ -155,6 +156,17 @@ public class PermissionsWsClient { WsSearchGlobalPermissionsResponse.parser()); } + public SearchProjectPermissionsWsResponse searchProjectPermissions(SearchProjectPermissionsWsRequest request) { + return wsClient.execute( + newGetRequest("search_project_permissions") + .setParam(PARAM_PROJECT_ID, request.getProjectId()) + .setParam(PARAM_PROJECT_KEY, request.getProjectKey()) + .setParam("p", request.getPage()) + .setParam("ps", request.getPageSize()) + .setParam("q", request.getQuery()), + SearchProjectPermissionsWsResponse.parser()); + } + private static String action(String action) { return PermissionsWsParameters.ENDPOINT + "/" + action; } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchProjectPermissionsWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchProjectPermissionsWsRequest.java new file mode 100644 index 00000000000..59a764f1e46 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchProjectPermissionsWsRequest.java @@ -0,0 +1,80 @@ +/* + * 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; + +public class SearchProjectPermissionsWsRequest { + private String projectId; + private String projectKey; + private int page; + private int pageSize; + private String query; + + @CheckForNull + public String getProjectId() { + return projectId; + } + + public SearchProjectPermissionsWsRequest setProjectId(@Nullable String projectId) { + this.projectId = projectId; + return this; + } + + @CheckForNull + public String getProjectKey() { + return projectKey; + } + + public SearchProjectPermissionsWsRequest setProjectKey(@Nullable String projectKey) { + this.projectKey = projectKey; + return this; + } + + public int getPage() { + return page; + } + + public SearchProjectPermissionsWsRequest setPage(int page) { + this.page = page; + return this; + } + + public int getPageSize() { + return pageSize; + } + + public SearchProjectPermissionsWsRequest setPageSize(int pageSize) { + this.pageSize = pageSize; + return this; + } + + @CheckForNull + public String getQuery() { + return query; + } + + public SearchProjectPermissionsWsRequest setQuery(@Nullable String query) { + this.query = query; + return this; + } +} diff --git a/sonar-ws/src/main/protobuf/ws-permissions.proto b/sonar-ws/src/main/protobuf/ws-permissions.proto index 7ca6e7417ce..d4ed7629541 100644 --- a/sonar-ws/src/main/protobuf/ws-permissions.proto +++ b/sonar-ws/src/main/protobuf/ws-permissions.proto @@ -44,7 +44,7 @@ message WsSearchGlobalPermissionsResponse { repeated Permission permissions = 1; } -message WsSearchProjectPermissionsResponse { +message SearchProjectPermissionsWsResponse { message Project { optional string id = 1; optional string key = 2; |