Search in sources :

Example 6 with PermissionTemplateGroupDto

use of org.sonar.db.permission.template.PermissionTemplateGroupDto 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");
}
Also used : PermissionTemplateDto(org.sonar.db.permission.template.PermissionTemplateDto) PermissionTemplateTesting.newPermissionTemplateDto(org.sonar.db.permission.template.PermissionTemplateTesting.newPermissionTemplateDto) PermissionTemplateGroupDto(org.sonar.db.permission.template.PermissionTemplateGroupDto) Test(org.junit.Test)

Aggregations

PermissionTemplateDto (org.sonar.db.permission.template.PermissionTemplateDto)6 PermissionTemplateGroupDto (org.sonar.db.permission.template.PermissionTemplateGroupDto)6 Test (org.junit.Test)4 DefaultTemplates (org.sonar.db.organization.DefaultTemplates)3 GroupDto (org.sonar.db.user.GroupDto)3 DbSession (org.sonar.db.DbSession)2 OrganizationDto (org.sonar.db.organization.OrganizationDto)2 PermissionTemplateTesting.newPermissionTemplateDto (org.sonar.db.permission.template.PermissionTemplateTesting.newPermissionTemplateDto)2 Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)1 String.format (java.lang.String.format)1 MessageFormat (java.text.MessageFormat)1 ArrayList (java.util.ArrayList)1 Arrays.asList (java.util.Arrays.asList)1 Collection (java.util.Collection)1 Collections.singletonList (java.util.Collections.singletonList)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Set (java.util.Set)1 CheckForNull (javax.annotation.CheckForNull)1 Nullable (javax.annotation.Nullable)1