use of org.sonar.server.usergroups.ws.GroupIdOrAnyone in project sonarqube by SonarSource.
the class GroupPermissionChangerTest method add_project_permission_to_group.
@Test
public void add_project_permission_to_group() {
GroupIdOrAnyone groupId = new GroupIdOrAnyone(group);
apply(new GroupPermissionChange(PermissionChange.Operation.ADD, UserRole.ISSUE_ADMIN, new ProjectId(project), groupId));
assertThat(db.users().selectGroupPermissions(group, null)).isEmpty();
assertThat(db.users().selectGroupPermissions(group, project)).containsOnly(UserRole.ISSUE_ADMIN);
}
use of org.sonar.server.usergroups.ws.GroupIdOrAnyone in project sonarqube by SonarSource.
the class GroupPermissionChangerTest method add_project_permission_to_anyone.
@Test
public void add_project_permission_to_anyone() {
GroupIdOrAnyone groupId = new GroupIdOrAnyone(org.getUuid(), null);
apply(new GroupPermissionChange(PermissionChange.Operation.ADD, UserRole.ISSUE_ADMIN, new ProjectId(project), groupId));
assertThat(db.users().selectAnyonePermissions(org, null)).isEmpty();
assertThat(db.users().selectAnyonePermissions(org, project)).containsOnly(UserRole.ISSUE_ADMIN);
}
use of org.sonar.server.usergroups.ws.GroupIdOrAnyone in project sonarqube by SonarSource.
the class GroupPermissionChangerTest method fail_to_add_project_permission_on_global_group.
@Test
public void fail_to_add_project_permission_on_global_group() {
GroupIdOrAnyone groupId = new GroupIdOrAnyone(group);
expectedException.expect(BadRequestException.class);
expectedException.expectMessage("Invalid global permission 'issueadmin'. Valid values are [admin, profileadmin, gateadmin, scan, provisioning]");
apply(new GroupPermissionChange(PermissionChange.Operation.ADD, UserRole.ISSUE_ADMIN, null, groupId));
}
use of org.sonar.server.usergroups.ws.GroupIdOrAnyone in project sonarqube by SonarSource.
the class GroupPermissionChangerTest method remove_project_permission_from_group.
@Test
public void remove_project_permission_from_group() {
GroupIdOrAnyone groupId = new GroupIdOrAnyone(group);
db.users().insertPermissionOnGroup(group, ADMINISTER_QUALITY_GATES);
db.users().insertProjectPermissionOnGroup(group, UserRole.ISSUE_ADMIN, project);
db.users().insertProjectPermissionOnGroup(group, UserRole.CODEVIEWER, project);
apply(new GroupPermissionChange(PermissionChange.Operation.REMOVE, UserRole.ISSUE_ADMIN, new ProjectId(project), groupId));
assertThat(db.users().selectGroupPermissions(group, null)).containsOnly(ADMINISTER_QUALITY_GATES.getKey());
assertThat(db.users().selectGroupPermissions(group, project)).containsOnly(UserRole.CODEVIEWER);
}
use of org.sonar.server.usergroups.ws.GroupIdOrAnyone in project sonarqube by SonarSource.
the class GroupPermissionChangerTest method fail_to_add_global_permission_on_project.
@Test
public void fail_to_add_global_permission_on_project() {
GroupIdOrAnyone groupId = new GroupIdOrAnyone(group);
expectedException.expect(BadRequestException.class);
expectedException.expectMessage("Invalid project permission 'gateadmin'. Valid values are [admin, codeviewer, issueadmin, scan, user]");
apply(new GroupPermissionChange(PermissionChange.Operation.ADD, GlobalPermissions.QUALITY_GATE_ADMIN, new ProjectId(project), groupId));
}
Aggregations