use of org.sonarqube.ws.client.permission.AddGroupWsRequest in project sonarqube by SonarSource.
the class PermissionSearchTest method permission_web_services.
@Test
public void permission_web_services() {
permissionsWsClient.addUser(new AddUserWsRequest().setPermission("admin").setLogin(LOGIN));
permissionsWsClient.addGroup(new AddGroupWsRequest().setPermission("admin").setGroupName(GROUP_NAME));
WsPermissions.WsSearchGlobalPermissionsResponse searchGlobalPermissionsWsResponse = permissionsWsClient.searchGlobalPermissions();
assertThat(searchGlobalPermissionsWsResponse.getPermissionsList().get(0).getKey()).isEqualTo("admin");
assertThat(searchGlobalPermissionsWsResponse.getPermissionsList().get(0).getUsersCount()).isEqualTo(1);
// by default, a group has the global admin permission
assertThat(searchGlobalPermissionsWsResponse.getPermissionsList().get(0).getGroupsCount()).isEqualTo(2);
WsPermissions.UsersWsResponse users = permissionsWsClient.users(new UsersWsRequest().setPermission("admin"));
assertThat(users.getUsersList()).extracting("login").contains(LOGIN);
WsPermissions.WsGroupsResponse groupsResponse = permissionsWsClient.groups(new GroupsWsRequest().setPermission("admin"));
assertThat(groupsResponse.getGroupsList()).extracting("name").contains(GROUP_NAME);
}
use of org.sonarqube.ws.client.permission.AddGroupWsRequest in project sonarqube by SonarSource.
the class ProvisioningPermissionTest method restoreData.
@AfterClass
public static void restoreData() throws Exception {
userRule.resetUsers();
permissionsWsClient.addGroup(new AddGroupWsRequest().setGroupName("anyone").setPermission("provisioning"));
}
use of org.sonarqube.ws.client.permission.AddGroupWsRequest in project sonarqube by SonarSource.
the class SettingsTest method tearDown.
@AfterClass
public static void tearDown() throws Exception {
userRule.deactivateUsers("setting-user", "scanner-user");
// Restore 'Execute Analysis' permission to anyone
adminWsClient.permissions().addGroup(new AddGroupWsRequest().setGroupName("anyone").setPermission("scan"));
}
Aggregations