diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-11-12 11:15:00 +0100 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-11-17 13:40:59 +0100 |
commit | 614a6496873c9b8f2149c4ee17a3e738cea1f470 (patch) | |
tree | 0f6062ec14dcc731eb5ea1cc29a9893ceb48c0b6 /server | |
parent | a5426fe36e91f6647c0dda681962299d5d6fb950 (diff) | |
download | sonarqube-614a6496873c9b8f2149c4ee17a3e738cea1f470.tar.gz sonarqube-614a6496873c9b8f2149c4ee17a3e738cea1f470.zip |
SONAR-6947 Create and use AddUserWsRequest
Diffstat (limited to 'server')
12 files changed, 66 insertions, 42 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddUserAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddUserAction.java index 367dd9e4c54..04fd12a8b76 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddUserAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddUserAction.java @@ -20,6 +20,7 @@ package org.sonar.server.permission.ws; +import com.google.common.base.Optional; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; @@ -27,11 +28,17 @@ import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.server.permission.PermissionChange; import org.sonar.server.permission.PermissionUpdater; -import org.sonar.server.permission.ws.PermissionRequest.Builder; +import org.sonarqube.ws.client.permission.AddUserWsRequest; +import static org.sonar.server.permission.ws.PermissionRequestValidator.validatePermission; import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createPermissionParameter; import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createProjectParameter; import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createUserLoginParameter; +import static org.sonar.server.permission.ws.WsProjectRef.newOptionalWsProjectRef; +import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION; +import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_ID; +import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY; +import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_USER_LOGIN; public class AddUserAction implements PermissionsWsAction { @@ -64,15 +71,32 @@ public class AddUserAction implements PermissionsWsAction { @Override public void handle(Request request, Response response) throws Exception { + doHandle(toAddUserWsRequest(request)); + response.noContent(); + } + + private void doHandle(AddUserWsRequest request) { + Optional<WsProjectRef> projectRef = newOptionalWsProjectRef(request.getProjectId(), request.getProjectKey()); + validatePermission(request.getPermission(), projectRef); DbSession dbSession = dbClient.openSession(false); try { - PermissionRequest permissionRequest = new Builder(request).withUser().build(); - PermissionChange permissionChange = permissionChangeBuilder.buildUserPermissionChange(dbSession, permissionRequest); + PermissionChange permissionChange = permissionChangeBuilder.buildUserPermissionChange( + dbSession, + request.getPermission(), + projectRef, + request.getLogin()); permissionUpdater.addPermission(permissionChange); - response.noContent(); } finally { dbClient.closeSession(dbSession); } } + + private static AddUserWsRequest toAddUserWsRequest(Request request) { + return new AddUserWsRequest() + .setPermission(request.mandatoryParam(PARAM_PERMISSION)) + .setLogin(request.mandatoryParam(PARAM_USER_LOGIN)) + .setProjectId(request.param(PARAM_PROJECT_ID)) + .setProjectKey(request.param(PARAM_PROJECT_KEY)); + } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionChangeBuilder.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionChangeBuilder.java index 12d86ca11f8..8f82a4acae8 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionChangeBuilder.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionChangeBuilder.java @@ -36,11 +36,11 @@ public class PermissionChangeBuilder { this.dependenciesFinder = dependenciesFinder; } - public PermissionChange buildUserPermissionChange(DbSession dbSession, PermissionRequest request) { + public PermissionChange buildUserPermissionChange(DbSession dbSession, String permission, Optional<WsProjectRef> projectRef, String login) { PermissionChange permissionChange = new PermissionChange() - .setPermission(request.permission()) - .setUserLogin(request.userLogin()); - addProjectToPermissionChange(dbSession, permissionChange, request.project()); + .setPermission(permission) + .setUserLogin(login); + addProjectToPermissionChange(dbSession, permissionChange, projectRef); return permissionChange; } 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 ea9e8cfe5da..aa18be8aba4 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 @@ -25,7 +25,6 @@ import org.sonar.api.server.ws.WebService; import static org.sonarqube.ws.client.permission.PermissionsWsParameters.ENDPOINT; public class PermissionsWs implements WebService { - private final PermissionsWsAction[] actions; public PermissionsWs(PermissionsWsAction... actions) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveUserAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveUserAction.java index 127307e1513..14b71ec299a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveUserAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveUserAction.java @@ -67,7 +67,11 @@ public class RemoveUserAction implements PermissionsWsAction { DbSession dbSession = dbClient.openSession(false); try { PermissionRequest permissionRequest = new Builder(request).withUser().build(); - PermissionChange permissionChange = permissionChangeBuilder.buildUserPermissionChange(dbSession, permissionRequest); + PermissionChange permissionChange = permissionChangeBuilder.buildUserPermissionChange( + dbSession, + permissionRequest.permission(), + permissionRequest.project(), + permissionRequest.userLogin()); permissionUpdater.removePermission(permissionChange); response.noContent(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddGroupActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddGroupActionTest.java index dacd4e47dec..ffce0b2aaaf 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddGroupActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddGroupActionTest.java @@ -53,7 +53,7 @@ import static org.sonar.core.permission.GlobalPermissions.SYSTEM_ADMIN; import static org.sonar.db.component.ComponentTesting.newProjectDto; import static org.sonar.db.component.ComponentTesting.newView; import static org.sonar.server.permission.ws.AddGroupAction.ACTION; -import static org.sonar.server.permission.ws.PermissionsWs.ENDPOINT; +import static org.sonarqube.ws.client.permission.PermissionsWsParameters.ENDPOINT; import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_ID; import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_NAME; import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION; diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddUserActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddUserActionTest.java index 3b8b51cbd57..fee6e5a2ae3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddUserActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddUserActionTest.java @@ -53,7 +53,7 @@ import static org.sonar.db.component.ComponentTesting.newFileDto; import static org.sonar.db.component.ComponentTesting.newProjectDto; import static org.sonar.db.component.ComponentTesting.newView; import static org.sonar.server.permission.ws.AddUserAction.ACTION; -import static org.sonar.server.permission.ws.PermissionsWs.ENDPOINT; +import static org.sonarqube.ws.client.permission.PermissionsWsParameters.ENDPOINT; import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION; import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_ID; import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY; diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveGroupActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveGroupActionTest.java index fc61fc7e1c9..2bcf60caea9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveGroupActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveGroupActionTest.java @@ -53,12 +53,13 @@ import static org.sonar.core.permission.GlobalPermissions.SYSTEM_ADMIN; import static org.sonar.db.component.ComponentTesting.newFileDto; import static org.sonar.db.component.ComponentTesting.newProjectDto; import static org.sonar.db.component.ComponentTesting.newView; +import static org.sonar.server.permission.ws.RemoveGroupAction.ACTION; +import static org.sonarqube.ws.client.permission.PermissionsWsParameters.ENDPOINT; import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_ID; import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_NAME; import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY; import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_ID; -import static org.sonar.server.permission.ws.RemoveGroupAction.ACTION; +import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY; @Category(DbTests.class) public class RemoveGroupActionTest { @@ -204,7 +205,7 @@ public class RemoveGroupActionTest { public void fail_when_get_request() throws Exception { expectedException.expect(ServerException.class); - ws.newGetRequest(PermissionsWs.ENDPOINT, ACTION) + ws.newGetRequest(ENDPOINT, ACTION) .setParam(PARAM_GROUP_NAME, "sonar-administrators") .setParam(PARAM_PERMISSION, SYSTEM_ADMIN) .execute(); @@ -255,7 +256,7 @@ public class RemoveGroupActionTest { } private WsTester.TestRequest newRequest() { - return ws.newPostRequest(PermissionsWs.ENDPOINT, ACTION); + return ws.newPostRequest(ENDPOINT, ACTION); } private GroupDto insertGroup(String groupName) { diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveUserActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveUserActionTest.java index c152c42a9a3..a62a5a285ba 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveUserActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveUserActionTest.java @@ -52,12 +52,12 @@ import static org.sonar.core.permission.GlobalPermissions.SYSTEM_ADMIN; import static org.sonar.db.component.ComponentTesting.newFileDto; import static org.sonar.db.component.ComponentTesting.newProjectDto; import static org.sonar.db.component.ComponentTesting.newView; +import static org.sonar.server.permission.ws.RemoveUserAction.ACTION; +import static org.sonarqube.ws.client.permission.PermissionsWsParameters.ENDPOINT; import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY; import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_ID; +import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY; import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_USER_LOGIN; -import static org.sonar.server.permission.ws.PermissionsWs.ENDPOINT; -import static org.sonar.server.permission.ws.RemoveUserAction.ACTION; @Category(DbTests.class) public class RemoveUserActionTest { @@ -86,7 +86,7 @@ public class RemoveUserActionTest { @Test public void call_permission_service_with_right_data() throws Exception { - ws.newPostRequest(PermissionsWs.ENDPOINT, ACTION) + ws.newPostRequest(ENDPOINT, ACTION) .setParam(PARAM_USER_LOGIN, "ray.bradbury") .setParam(PARAM_PERMISSION, SYSTEM_ADMIN) .execute(); @@ -101,7 +101,7 @@ public class RemoveUserActionTest { public void remove_with_project_uuid() throws Exception { insertComponent(newProjectDto("project-uuid").setKey("project-key")); - ws.newPostRequest(PermissionsWs.ENDPOINT, ACTION) + ws.newPostRequest(ENDPOINT, ACTION) .setParam(PARAM_USER_LOGIN, "ray.bradbury") .setParam(PARAM_PROJECT_ID, "project-uuid") .setParam(PARAM_PERMISSION, SYSTEM_ADMIN) @@ -116,7 +116,7 @@ public class RemoveUserActionTest { public void remove_with_project_key() throws Exception { insertComponent(newProjectDto("project-uuid").setKey("project-key")); - ws.newPostRequest(PermissionsWs.ENDPOINT, ACTION) + ws.newPostRequest(ENDPOINT, ACTION) .setParam(PARAM_USER_LOGIN, "ray.bradbury") .setParam(PARAM_PROJECT_KEY, "project-key") .setParam(PARAM_PERMISSION, SYSTEM_ADMIN) @@ -131,7 +131,7 @@ public class RemoveUserActionTest { public void remove_with_view_uuid() throws Exception { insertComponent(newView("view-uuid").setKey("view-key")); - ws.newPostRequest(PermissionsWs.ENDPOINT, ACTION) + ws.newPostRequest(ENDPOINT, ACTION) .setParam(PARAM_USER_LOGIN, "ray.bradbury") .setParam(PARAM_PROJECT_ID, "view-uuid") .setParam(PARAM_PERMISSION, SYSTEM_ADMIN) @@ -146,7 +146,7 @@ public class RemoveUserActionTest { public void fail_when_project_does_not_exist() throws Exception { expectedException.expect(NotFoundException.class); - ws.newPostRequest(PermissionsWs.ENDPOINT, ACTION) + ws.newPostRequest(ENDPOINT, ACTION) .setParam(PARAM_USER_LOGIN, "ray.bradbury") .setParam(PARAM_PROJECT_ID, "unknown-project-uuid") .setParam(PARAM_PERMISSION, UserRole.ISSUE_ADMIN) @@ -157,7 +157,7 @@ public class RemoveUserActionTest { public void fail_when_project_permission_without_permission() throws Exception { expectedException.expect(BadRequestException.class); - ws.newPostRequest(PermissionsWs.ENDPOINT, ACTION) + ws.newPostRequest(ENDPOINT, ACTION) .setParam(PARAM_USER_LOGIN, "ray.bradbury") .setParam(PARAM_PERMISSION, UserRole.ISSUE_ADMIN) .execute(); @@ -168,7 +168,7 @@ public class RemoveUserActionTest { expectedException.expect(BadRequestException.class); insertComponent(newFileDto(newProjectDto(), "file-uuid")); - ws.newPostRequest(PermissionsWs.ENDPOINT, ACTION) + ws.newPostRequest(ENDPOINT, ACTION) .setParam(PARAM_USER_LOGIN, "ray.bradbury") .setParam(PARAM_PROJECT_ID, "file-uuid") .setParam(PARAM_PERMISSION, SYSTEM_ADMIN) @@ -179,7 +179,7 @@ public class RemoveUserActionTest { public void fail_when_get_request() throws Exception { expectedException.expect(ServerException.class); - ws.newGetRequest(PermissionsWs.ENDPOINT, ACTION) + ws.newGetRequest(ENDPOINT, ACTION) .setParam(PARAM_USER_LOGIN, "george.orwell") .setParam(PARAM_PERMISSION, SYSTEM_ADMIN) .execute(); @@ -189,7 +189,7 @@ public class RemoveUserActionTest { public void fail_when_user_login_is_missing() throws Exception { expectedException.expect(IllegalArgumentException.class); - ws.newPostRequest(PermissionsWs.ENDPOINT, ACTION) + ws.newPostRequest(ENDPOINT, ACTION) .setParam(PARAM_PERMISSION, SYSTEM_ADMIN) .execute(); } @@ -198,7 +198,7 @@ public class RemoveUserActionTest { public void fail_when_permission_is_missing() throws Exception { expectedException.expect(IllegalArgumentException.class); - ws.newPostRequest(PermissionsWs.ENDPOINT, ACTION) + ws.newPostRequest(ENDPOINT, ACTION) .setParam(PARAM_USER_LOGIN, "jrr.tolkien") .execute(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/AddGroupToTemplateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/AddGroupToTemplateActionTest.java index 71c23d05a57..659011e12ce 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/AddGroupToTemplateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/AddGroupToTemplateActionTest.java @@ -47,7 +47,6 @@ import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.exceptions.UnauthorizedException; import org.sonar.server.permission.ws.PermissionDependenciesFinder; -import org.sonar.server.permission.ws.PermissionsWsParametersBuilder; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.usergroups.ws.UserGroupFinder; import org.sonar.server.ws.TestRequest; @@ -66,8 +65,8 @@ import static org.sonar.db.user.GroupTesting.newGroupDto; import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_ID; import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_NAME; import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_UUID; import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_NAME; +import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_UUID; @Category(DbTests.class) public class AddGroupToTemplateActionTest { @@ -217,13 +216,13 @@ public class AddGroupToTemplateActionTest { private void newRequest(@Nullable String groupName, @Nullable String templateKey, @Nullable String permission) { TestRequest request = ws.newRequest(); if (groupName != null) { - request.setParam(PermissionsWsParametersBuilder.PARAM_GROUP_NAME, groupName); + request.setParam(PARAM_GROUP_NAME, groupName); } if (templateKey != null) { request.setParam(PARAM_TEMPLATE_UUID, templateKey); } if (permission != null) { - request.setParam(PermissionsWsParametersBuilder.PARAM_PERMISSION, permission); + request.setParam(PARAM_PERMISSION, permission); } request.execute(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/AddUserToTemplateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/AddUserToTemplateActionTest.java index 4e5ba547cbc..e50b5cf3d98 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/AddUserToTemplateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/AddUserToTemplateActionTest.java @@ -46,7 +46,6 @@ import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.exceptions.UnauthorizedException; import org.sonar.server.permission.ws.PermissionDependenciesFinder; -import org.sonar.server.permission.ws.PermissionsWsParametersBuilder; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.usergroups.ws.UserGroupFinder; import org.sonar.server.ws.TestRequest; @@ -192,7 +191,7 @@ public class AddUserToTemplateActionTest { request.setParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_UUID, templateKey); } if (permission != null) { - request.setParam(PermissionsWsParametersBuilder.PARAM_PERMISSION, permission); + request.setParam(PARAM_PERMISSION, permission); } request.execute(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/RemoveGroupFromTemplateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/RemoveGroupFromTemplateActionTest.java index c85fcd7a8dc..e690b04a8be 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/RemoveGroupFromTemplateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/RemoveGroupFromTemplateActionTest.java @@ -46,7 +46,6 @@ import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.exceptions.UnauthorizedException; import org.sonar.server.permission.ws.PermissionDependenciesFinder; -import org.sonar.server.permission.ws.PermissionsWsParametersBuilder; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.usergroups.ws.UserGroupFinder; import org.sonar.server.ws.TestRequest; @@ -220,13 +219,13 @@ public class RemoveGroupFromTemplateActionTest { private void newRequest(@Nullable String groupName, @Nullable String templateKey, @Nullable String permission) { TestRequest request = ws.newRequest(); if (groupName != null) { - request.setParam(PermissionsWsParametersBuilder.PARAM_GROUP_NAME, groupName); + request.setParam(PARAM_GROUP_NAME, groupName); } if (templateKey != null) { request.setParam(PARAM_TEMPLATE_UUID, templateKey); } if (permission != null) { - request.setParam(PermissionsWsParametersBuilder.PARAM_PERMISSION, permission); + request.setParam(PARAM_PERMISSION, permission); } request.execute(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/RemoveUserFromTemplateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/RemoveUserFromTemplateActionTest.java index 254dbf9cbe5..ee2e6023bd8 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/RemoveUserFromTemplateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/RemoveUserFromTemplateActionTest.java @@ -46,7 +46,6 @@ import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.exceptions.UnauthorizedException; import org.sonar.server.permission.ws.PermissionDependenciesFinder; -import org.sonar.server.permission.ws.PermissionsWsParametersBuilder; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.usergroups.ws.UserGroupFinder; import org.sonar.server.ws.TestRequest; @@ -216,7 +215,7 @@ public class RemoveUserFromTemplateActionTest { request.setParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_UUID, templateKey); } if (permission != null) { - request.setParam(PermissionsWsParametersBuilder.PARAM_PERMISSION, permission); + request.setParam(PARAM_PERMISSION, permission); } request.execute(); @@ -238,8 +237,8 @@ public class RemoveUserFromTemplateActionTest { PermissionQuery permissionQuery = PermissionQuery.builder().permission(permission).membership(IN).build(); return from(dbClient.permissionTemplateDao() .selectUsers(dbSession, permissionQuery, templateId, 0, Integer.MAX_VALUE)) - .transform(UserWithPermissionToUserLogin.INSTANCE) - .toList(); + .transform(UserWithPermissionToUserLogin.INSTANCE) + .toList(); } private enum UserWithPermissionToUserLogin implements Function<UserWithPermissionDto, String> { |