Optional<GroupDto> admins = dbClient.groupDao().selectByName(dbSession, template.getOrganizationUuid(), DefaultGroups.ADMINISTRATORS);
if (admins.isPresent()) {
insertGroupPermission(dbSession, template, UserRole.ADMIN, admins.get());
- insertGroupPermission(dbSession, template, UserRole.ISSUE_ADMIN, admins.get());
- insertGroupPermission(dbSession, template, UserRole.SECURITYHOTSPOT_ADMIN, admins.get());
insertGroupPermission(dbSession, template, OrganizationPermission.APPLICATION_CREATOR.getKey(), admins.get());
insertGroupPermission(dbSession, template, OrganizationPermission.PORTFOLIO_CREATOR.getKey(), admins.get());
} else {
.orElseThrow(() -> new IllegalStateException(format("Default group with id %s for organization %s doesn't exist", defaultGroupId, organizationUuid)));
insertGroupPermission(dbSession, template, UserRole.USER, defaultGroup);
insertGroupPermission(dbSession, template, UserRole.CODEVIEWER, defaultGroup);
+ insertGroupPermission(dbSession, template, UserRole.ISSUE_ADMIN, defaultGroup);
+ insertGroupPermission(dbSession, template, UserRole.SECURITYHOTSPOT_ADMIN, defaultGroup);
}
private void insertGroupPermission(DbSession dbSession, PermissionTemplateDto template, String permission, GroupDto group) {
import org.sonar.api.utils.log.LogTester;
import org.sonar.api.utils.log.LoggerLevel;
import org.sonar.api.web.UserRole;
-import org.sonar.api.web.page.Page;
import org.sonar.db.DbTester;
import org.sonar.db.organization.DefaultTemplates;
import org.sonar.db.permission.OrganizationPermission;
List<PermissionTemplateGroupDto> groupPermissions = selectGroupPermissions(defaultTemplate);
assertThat(groupPermissions).hasSize(7);
expectGroupPermission(groupPermissions, UserRole.ADMIN, DefaultGroups.ADMINISTRATORS);
- expectGroupPermission(groupPermissions, UserRole.ISSUE_ADMIN, DefaultGroups.ADMINISTRATORS);
- expectGroupPermission(groupPermissions, UserRole.SECURITYHOTSPOT_ADMIN, DefaultGroups.ADMINISTRATORS);
expectGroupPermission(groupPermissions, OrganizationPermission.APPLICATION_CREATOR.getKey(), DefaultGroups.ADMINISTRATORS);
expectGroupPermission(groupPermissions, OrganizationPermission.PORTFOLIO_CREATOR.getKey(), DefaultGroups.ADMINISTRATORS);
expectGroupPermission(groupPermissions, UserRole.CODEVIEWER, defaultGroup.getName());
expectGroupPermission(groupPermissions, UserRole.USER, defaultGroup.getName());
+ expectGroupPermission(groupPermissions, UserRole.ISSUE_ADMIN, defaultGroup.getName());
+ expectGroupPermission(groupPermissions, UserRole.SECURITYHOTSPOT_ADMIN, defaultGroup.getName());
verifyDefaultTemplates();
List<PermissionTemplateGroupDto> groupPermissions = selectGroupPermissions(defaultTemplate);
assertThat(groupPermissions).hasSize(7);
expectGroupPermission(groupPermissions, UserRole.ADMIN, DefaultGroups.ADMINISTRATORS);
- expectGroupPermission(groupPermissions, UserRole.ISSUE_ADMIN, DefaultGroups.ADMINISTRATORS);
- expectGroupPermission(groupPermissions, UserRole.SECURITYHOTSPOT_ADMIN, DefaultGroups.ADMINISTRATORS);
expectGroupPermission(groupPermissions, OrganizationPermission.APPLICATION_CREATOR.getKey(), DefaultGroups.ADMINISTRATORS);
expectGroupPermission(groupPermissions, OrganizationPermission.PORTFOLIO_CREATOR.getKey(), DefaultGroups.ADMINISTRATORS);
expectGroupPermission(groupPermissions, UserRole.CODEVIEWER, defaultGroup.getName());
expectGroupPermission(groupPermissions, UserRole.USER, defaultGroup.getName());
+ expectGroupPermission(groupPermissions, UserRole.ISSUE_ADMIN, defaultGroup.getName());
+ expectGroupPermission(groupPermissions, UserRole.SECURITYHOTSPOT_ADMIN, defaultGroup.getName());
verifyDefaultTemplates();
assertThat(defaultTemplate.getName()).isEqualTo("Default template");
List<PermissionTemplateGroupDto> groupPermissions = selectGroupPermissions(defaultTemplate);
- assertThat(groupPermissions).hasSize(2);
+ assertThat(groupPermissions).hasSize(4);
expectGroupPermission(groupPermissions, UserRole.CODEVIEWER, defaultGroup.getName());
expectGroupPermission(groupPermissions, UserRole.USER, defaultGroup.getName());
+ expectGroupPermission(groupPermissions, UserRole.ISSUE_ADMIN, defaultGroup.getName());
+ expectGroupPermission(groupPermissions, UserRole.SECURITYHOTSPOT_ADMIN, defaultGroup.getName());
verifyDefaultTemplates();