use of org.sonar.db.user.GroupDto in project sonarqube by SonarSource.
the class AddGroupActionTest method reference_group_by_its_name_in_organization.
@Test
public void reference_group_by_its_name_in_organization() throws Exception {
OrganizationDto org = db.organizations().insert();
GroupDto group = db.users().insertGroup(org, "the-group");
loginAsAdmin(org);
newRequest().setParam(PARAM_ORGANIZATION, org.getKey()).setParam(PARAM_GROUP_NAME, group.getName()).setParam(PARAM_PERMISSION, PROVISIONING).execute();
assertThat(db.users().selectGroupPermissions(group, null)).containsOnly(PROVISIONING);
}
use of org.sonar.db.user.GroupDto in project sonarqube by SonarSource.
the class GroupsActionTest method return_only_groups_with_permission_when_no_search_query.
@Test
public void return_only_groups_with_permission_when_no_search_query() throws Exception {
ComponentDto project = db.components().insertComponent(newProjectDto(db.getDefaultOrganization(), "project-uuid"));
GroupDto group = db.users().insertGroup(db.getDefaultOrganization(), "project-group-name");
db.users().insertProjectPermissionOnGroup(group, ISSUE_ADMIN, project);
GroupDto groupWithoutPermission = db.users().insertGroup(db.getDefaultOrganization(), "group-without-permission");
loginAsAdmin(db.getDefaultOrganization());
String result = newRequest().setParam(PARAM_PERMISSION, ISSUE_ADMIN).setParam(PARAM_PROJECT_ID, project.uuid()).execute().getInput();
assertThat(result).contains(group.getName()).doesNotContain(groupWithoutPermission.getName());
}
use of org.sonar.db.user.GroupDto in project sonarqube by SonarSource.
the class GroupsActionTest method return_anyone_group_when_search_query_and_no_param_permission.
@Test
public void return_anyone_group_when_search_query_and_no_param_permission() throws Exception {
OrganizationDto organizationDto = db.organizations().insert();
ComponentDto project = db.components().insertComponent(newProjectDto(organizationDto, "project-uuid"));
GroupDto group = db.users().insertGroup(organizationDto, "group-with-permission");
db.users().insertProjectPermissionOnGroup(group, ISSUE_ADMIN, project);
loginAsAdmin(db.getDefaultOrganization());
String result = newRequest().setParam(PARAM_PROJECT_ID, project.uuid()).setParam(TEXT_QUERY, "nyo").execute().getInput();
assertThat(result).contains("Anyone");
}
use of org.sonar.db.user.GroupDto in project sonarqube by SonarSource.
the class GroupsActionTest method search_groups_on_views.
@Test
public void search_groups_on_views() throws Exception {
ComponentDto view = db.components().insertComponent(newView(db.getDefaultOrganization(), "view-uuid").setKey("view-key"));
GroupDto group = db.users().insertGroup(db.getDefaultOrganization(), "project-group-name");
db.users().insertProjectPermissionOnGroup(group, ISSUE_ADMIN, view);
loginAsAdmin(db.getDefaultOrganization());
String result = newRequest().setParam(PARAM_PERMISSION, ISSUE_ADMIN).setParam(PARAM_PROJECT_ID, "view-uuid").execute().getInput();
assertThat(result).contains("project-group-name").doesNotContain("group-1").doesNotContain("group-2").doesNotContain("group-3");
}
use of org.sonar.db.user.GroupDto in project sonarqube by SonarSource.
the class GroupsActionTest method search_groups_with_project_permissions.
@Test
public void search_groups_with_project_permissions() throws Exception {
OrganizationDto organizationDto = db.getDefaultOrganization();
ComponentDto project = db.components().insertComponent(newProjectDto(organizationDto, "project-uuid"));
GroupDto group = db.users().insertGroup(organizationDto, "project-group-name");
db.users().insertProjectPermissionOnGroup(group, ISSUE_ADMIN, project);
ComponentDto anotherProject = db.components().insertComponent(newProjectDto(organizationDto));
GroupDto anotherGroup = db.users().insertGroup(organizationDto, "another-project-group-name");
db.users().insertProjectPermissionOnGroup(anotherGroup, ISSUE_ADMIN, anotherProject);
GroupDto groupWithoutPermission = db.users().insertGroup(organizationDto, "group-without-permission");
userSession.logIn().addProjectUuidPermissions(ADMIN, "project-uuid");
String result = newRequest().setParam(PARAM_PERMISSION, ISSUE_ADMIN).setParam(PARAM_PROJECT_ID, "project-uuid").execute().getInput();
assertThat(result).contains(group.getName()).doesNotContain(anotherGroup.getName()).doesNotContain(groupWithoutPermission.getName());
}
Aggregations