]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-17208 Remove extra permissions from the default permissions template
authorMatteo Mara <matteo.mara@sonarsource.com>
Thu, 18 Aug 2022 10:16:02 +0000 (12:16 +0200)
committersonartech <sonartech@sonarsource.com>
Fri, 19 Aug 2022 20:03:32 +0000 (20:03 +0000)
server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RegisterPermissionTemplates.java
server/sonar-webserver-core/src/test/java/org/sonar/server/startup/RegisterPermissionTemplatesTest.java

index 8a9732a738e4b108d4986e8f532f01401ac9d1bd..d60c3ef3e965352c533f0b5527e94c88a897ab01 100644 (file)
@@ -31,7 +31,6 @@ import org.sonar.api.web.UserRole;
 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;
@@ -98,8 +97,6 @@ public class RegisterPermissionTemplates implements Startable {
     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);
     }
index 7d3c9f4155d7257f69f011edda009447c1c23907..66fc957215226b636262ba72f82ca1028f32f993 100644 (file)
@@ -31,7 +31,6 @@ import org.sonar.api.utils.log.LoggerLevel;
 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;
@@ -61,10 +60,8 @@ public class RegisterPermissionTemplatesTest {
     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());