diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2016-07-06 02:02:47 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-07-12 10:16:53 +0200 |
commit | 2990ede97d1cedfd256869ab448dcd2864d7a6df (patch) | |
tree | ea693a7c5c3cca8c3347e26b9eaaa129de3b0c2a /sonar-ws | |
parent | a51fcb2ad90e74769b977d290213e85eb4ead443 (diff) | |
download | sonarqube-2990ede97d1cedfd256869ab448dcd2864d7a6df.tar.gz sonarqube-2990ede97d1cedfd256869ab448dcd2864d7a6df.zip |
SONAR-7835 WS permissions/users return permissions in response
Diffstat (limited to 'sonar-ws')
3 files changed, 16 insertions, 4 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsService.java index 2ce33d1fef6..697747e8219 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsService.java @@ -21,6 +21,7 @@ package org.sonarqube.ws.client.permission; import org.sonarqube.ws.WsPermissions; import org.sonarqube.ws.WsPermissions.CreateTemplateWsResponse; +import org.sonarqube.ws.WsPermissions.OldUsersWsResponse; import org.sonarqube.ws.WsPermissions.SearchProjectPermissionsWsResponse; import org.sonarqube.ws.WsPermissions.SearchTemplatesWsResponse; import org.sonarqube.ws.WsPermissions.UpdateTemplateWsResponse; @@ -213,7 +214,7 @@ public class PermissionsService extends BaseService { .setParam(PARAM_PROJECT_KEY_PATTERN, request.getProjectKeyPattern()), UpdateTemplateWsResponse.parser()); } - public UsersWsResponse users(OldUsersWsRequest request) { + public OldUsersWsResponse oldUsers(OldUsersWsRequest request) { return call(new GetRequest(path("users")) .setParam(PARAM_PERMISSION, request.getPermission()) .setParam(PARAM_PROJECT_ID, request.getProjectId()) @@ -221,6 +222,16 @@ public class PermissionsService extends BaseService { .setParam("selected", request.getSelected()) .setParam("p", request.getPage()) .setParam("ps", request.getPageSize()) + .setParam("q", request.getQuery()), OldUsersWsResponse.parser()); + } + + public UsersWsResponse users(UsersWsRequest request) { + return call(new GetRequest(path("users2")) + .setParam(PARAM_PERMISSION, request.getPermission()) + .setParam(PARAM_PROJECT_ID, request.getProjectId()) + .setParam(PARAM_PROJECT_KEY, request.getProjectKey()) + .setParam("p", request.getPage()) + .setParam("ps", request.getPageSize()) .setParam("q", request.getQuery()), UsersWsResponse.parser()); } } diff --git a/sonar-ws/src/main/protobuf/ws-permissions.proto b/sonar-ws/src/main/protobuf/ws-permissions.proto index 7477ee25d34..ceb2a559dad 100644 --- a/sonar-ws/src/main/protobuf/ws-permissions.proto +++ b/sonar-ws/src/main/protobuf/ws-permissions.proto @@ -116,7 +116,7 @@ message User { optional string login = 1; optional string name = 2; optional string email = 3; - optional bool selected = 4; + repeated string permissions = 4; } message Group { diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/permission/PermissionsServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/permission/PermissionsServiceTest.java index f9bdee7f197..d0e4e0a52e6 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/permission/PermissionsServiceTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/permission/PermissionsServiceTest.java @@ -22,6 +22,7 @@ package org.sonarqube.ws.client.permission; import org.junit.Rule; import org.junit.Test; import org.sonarqube.ws.WsPermissions; +import org.sonarqube.ws.WsPermissions.OldUsersWsResponse; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.ServiceTester; @@ -431,7 +432,7 @@ public class PermissionsServiceTest { @Test public void users_does_GET_on_Ws_users() { - underTest.users(new OldUsersWsRequest() + underTest.oldUsers(new OldUsersWsRequest() .setPermission(PERMISSION_VALUE) .setProjectId(PROJECT_ID_VALUE) .setProjectKey(PROJECT_KEY_VALUE) @@ -441,7 +442,7 @@ public class PermissionsServiceTest { .setQuery(QUERY_VALUE) ); - assertThat(serviceTester.getGetParser()).isSameAs(WsPermissions.UsersWsResponse.parser()); + assertThat(serviceTester.getGetParser()).isSameAs(OldUsersWsResponse.parser()); GetRequest getRequest = serviceTester.getGetRequest(); serviceTester.assertThat(getRequest) .hasPath("users") |