Search in sources :

Example 1 with RemoveGroupWsRequest

use of org.sonarqube.ws.client.permission.RemoveGroupWsRequest in project sonarqube by SonarSource.

the class ProvisioningPermissionTest method init.

@BeforeClass
public static void init() {
    permissionsWsClient = newAdminWsClient(orchestrator).permissions();
    // remove default permission "provisioning" from anyone();
    permissionsWsClient.removeGroup(new RemoveGroupWsRequest().setGroupName("anyone").setPermission("provisioning"));
    userRule.createUser(ADMIN_WITH_PROVISIONING, PASSWORD);
    addUserPermission(ADMIN_WITH_PROVISIONING, "admin");
    addUserPermission(ADMIN_WITH_PROVISIONING, "provisioning");
    userRule.createUser(ADMIN_WITHOUT_PROVISIONING, PASSWORD);
    addUserPermission(ADMIN_WITHOUT_PROVISIONING, "admin");
    removeUserPermission(ADMIN_WITHOUT_PROVISIONING, "provisioning");
    userRule.createUser(USER_WITH_PROVISIONING, PASSWORD);
    addUserPermission(USER_WITH_PROVISIONING, "provisioning");
    userRule.createUser(USER_WITHOUT_PROVISIONING, PASSWORD);
    removeUserPermission(USER_WITHOUT_PROVISIONING, "provisioning");
}
Also used : RemoveGroupWsRequest(org.sonarqube.ws.client.permission.RemoveGroupWsRequest) BeforeClass(org.junit.BeforeClass)

Example 2 with RemoveGroupWsRequest

use of org.sonarqube.ws.client.permission.RemoveGroupWsRequest in project sonarqube by SonarSource.

the class SettingsTest method initSettingsService.

@BeforeClass
public static void initSettingsService() throws Exception {
    userRule.createUser("setting-user", "setting-user");
    userRule.createUser("scanner-user", "scanner-user");
    adminWsClient = newAdminWsClient(orchestrator);
    // Remove 'Execute Analysis' permission from anyone
    adminWsClient.permissions().removeGroup(new RemoveGroupWsRequest().setGroupName("anyone").setPermission("scan"));
    // Anonymous user, without 'Execute Analysis' permission
    anonymousSettingsService = newWsClient(orchestrator).settingsService();
    // Authenticated user, without 'Execute Analysis' permission
    userSettingsService = newUserWsClient(orchestrator, "setting-user", "setting-user").settingsService();
    // User with 'Execute Analysis' permission
    adminWsClient.permissions().addUser(new AddUserWsRequest().setLogin("scanner-user").setPermission("scan"));
    scanSettingsService = newUserWsClient(orchestrator, "scanner-user", "scanner-user").settingsService();
    // User with 'Administer System' permission but without 'Execute Analysis' permission
    adminSettingsService = adminWsClient.settingsService();
}
Also used : RemoveGroupWsRequest(org.sonarqube.ws.client.permission.RemoveGroupWsRequest) AddUserWsRequest(org.sonarqube.ws.client.permission.AddUserWsRequest) BeforeClass(org.junit.BeforeClass)

Aggregations

BeforeClass (org.junit.BeforeClass)2 RemoveGroupWsRequest (org.sonarqube.ws.client.permission.RemoveGroupWsRequest)2 AddUserWsRequest (org.sonarqube.ws.client.permission.AddUserWsRequest)1