import org.sonar.core.util.UuidFactory;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
-import org.sonar.db.permission.GlobalPermission;
import org.sonar.db.permission.template.PermissionTemplateDto;
import org.sonar.db.user.GroupDto;
import org.sonar.server.usergroups.DefaultGroupFinder;
Optional<GroupDto> admins = dbClient.groupDao().selectByName(dbSession, DefaultGroups.ADMINISTRATORS);
if (admins.isPresent()) {
insertGroupPermission(dbSession, template, UserRole.ADMIN, admins.get());
- insertGroupPermission(dbSession, template, GlobalPermission.APPLICATION_CREATOR.getKey(), admins.get());
- insertGroupPermission(dbSession, template, GlobalPermission.PORTFOLIO_CREATOR.getKey(), admins.get());
} else {
LOG.error("Cannot setup default permission for group: " + DefaultGroups.ADMINISTRATORS);
}
import org.sonar.api.web.UserRole;
import org.sonar.core.util.UuidFactoryFast;
import org.sonar.db.DbTester;
-import org.sonar.db.permission.GlobalPermission;
import org.sonar.db.permission.template.PermissionTemplateDto;
import org.sonar.db.permission.template.PermissionTemplateGroupDto;
import org.sonar.db.user.GroupDto;
assertThat(defaultTemplate.getName()).isEqualTo("Default template");
List<PermissionTemplateGroupDto> groupPermissions = selectGroupPermissions(defaultTemplate);
- assertThat(groupPermissions).hasSize(7);
+ assertThat(groupPermissions).hasSize(5);
expectGroupPermission(groupPermissions, UserRole.ADMIN, DefaultGroups.ADMINISTRATORS);
- expectGroupPermission(groupPermissions, GlobalPermission.APPLICATION_CREATOR.getKey(), DefaultGroups.ADMINISTRATORS);
- expectGroupPermission(groupPermissions, GlobalPermission.PORTFOLIO_CREATOR.getKey(), DefaultGroups.ADMINISTRATORS);
expectGroupPermission(groupPermissions, UserRole.CODEVIEWER, defaultGroup.getName());
expectGroupPermission(groupPermissions, UserRole.USER, defaultGroup.getName());
expectGroupPermission(groupPermissions, UserRole.ISSUE_ADMIN, defaultGroup.getName());