use of org.sonar.db.permission.template.PermissionTemplateDto in project sonarqube by SonarSource.
the class RegisterPermissionTemplatesTest method ignore_administrators_permissions_if_group_does_not_exist.
@Test
public void ignore_administrators_permissions_if_group_does_not_exist() {
underTest.start();
PermissionTemplateDto defaultTemplate = selectTemplate();
assertThat(defaultTemplate.getName()).isEqualTo("Default template");
List<PermissionTemplateGroupDto> groupPermissions = selectGroupPermissions(defaultTemplate);
assertThat(groupPermissions).hasSize(2);
expectGroupPermission(groupPermissions, UserRole.CODEVIEWER, DefaultGroups.ANYONE);
expectGroupPermission(groupPermissions, UserRole.USER, DefaultGroups.ANYONE);
verifyDefaultTemplates();
assertThat(logTester.logs(LoggerLevel.ERROR)).contains("Cannot setup default permission for group: sonar-administrators");
}
use of org.sonar.db.permission.template.PermissionTemplateDto in project sonarqube by SonarSource.
the class DeleteActionTest method delete_group_from_permission_templates.
@Test
public void delete_group_from_permission_templates() throws Exception {
addAdminToDefaultOrganization();
GroupDto group = db.users().insertGroup();
PermissionTemplateDto template = db.getDbClient().permissionTemplateDao().insert(db.getSession(), PermissionTemplateTesting.newPermissionTemplateDto());
db.getDbClient().permissionTemplateDao().insertGroupPermission(db.getSession(), template.getId(), group.getId(), "perm");
db.commit();
loginAsAdminOnDefaultOrganization();
assertThat(db.countRowsOfTable("perm_templates_groups")).isEqualTo(1);
newRequest().setParam("id", group.getId().toString()).execute().assertNoContent();
assertThat(db.countRowsOfTable("perm_templates_groups")).isEqualTo(0);
}
Aggregations