diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2019-05-13 18:04:50 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2019-05-22 20:21:15 +0200 |
commit | ea8bc156195d95eef947ff49dd4d2535a3c56d26 (patch) | |
tree | 92c9306fccaaf19e48c359ba0fdb5fc45959457c /server | |
parent | 3775e29dbe727665644e7f0f4312cacb80518b38 (diff) | |
download | sonarqube-ea8bc156195d95eef947ff49dd4d2535a3c56d26.tar.gz sonarqube-ea8bc156195d95eef947ff49dd4d2535a3c56d26.zip |
SONARCLOUD-636 Update default org projects permission template
Diffstat (limited to 'server')
3 files changed, 20 insertions, 10 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/organization/OrganizationUpdaterImpl.java b/server/sonar-server/src/main/java/org/sonar/server/organization/OrganizationUpdaterImpl.java index 05429484f9a..b8d82a462bb 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/organization/OrganizationUpdaterImpl.java +++ b/server/sonar-server/src/main/java/org/sonar/server/organization/OrganizationUpdaterImpl.java @@ -234,11 +234,11 @@ public class OrganizationUpdaterImpl implements OrganizationUpdater { .setUpdatedAt(now)); insertGroupPermission(dbSession, permissionTemplateDto, ADMIN, ownerGroup); - insertGroupPermission(dbSession, permissionTemplateDto, ISSUE_ADMIN, ownerGroup); - insertGroupPermission(dbSession, permissionTemplateDto, SECURITYHOTSPOT_ADMIN, ownerGroup); insertGroupPermission(dbSession, permissionTemplateDto, SCAN.getKey(), ownerGroup); insertGroupPermission(dbSession, permissionTemplateDto, USER, defaultGroup); insertGroupPermission(dbSession, permissionTemplateDto, CODEVIEWER, defaultGroup); + insertGroupPermission(dbSession, permissionTemplateDto, ISSUE_ADMIN, defaultGroup); + insertGroupPermission(dbSession, permissionTemplateDto, SECURITYHOTSPOT_ADMIN, defaultGroup); dbClient.organizationDao().setDefaultTemplates( dbSession, @@ -260,11 +260,11 @@ public class OrganizationUpdaterImpl implements OrganizationUpdater { .setUpdatedAt(dateNow)); insertProjectCreatorPermission(dbSession, permissionTemplateDto, ADMIN, now); - insertProjectCreatorPermission(dbSession, permissionTemplateDto, ISSUE_ADMIN, now); - insertProjectCreatorPermission(dbSession, permissionTemplateDto, SECURITYHOTSPOT_ADMIN, now); insertProjectCreatorPermission(dbSession, permissionTemplateDto, SCAN.getKey(), now); insertGroupPermission(dbSession, permissionTemplateDto, USER, defaultGroup); insertGroupPermission(dbSession, permissionTemplateDto, CODEVIEWER, defaultGroup); + insertGroupPermission(dbSession, permissionTemplateDto, ISSUE_ADMIN, defaultGroup); + insertGroupPermission(dbSession, permissionTemplateDto, SECURITYHOTSPOT_ADMIN, defaultGroup); dbClient.organizationDao().setDefaultTemplates( dbSession, diff --git a/server/sonar-server/src/test/java/org/sonar/server/organization/OrganizationUpdaterImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/organization/OrganizationUpdaterImplTest.java index 099b2ba15c4..77a858eb9a7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/organization/OrganizationUpdaterImplTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/organization/OrganizationUpdaterImplTest.java @@ -203,9 +203,12 @@ public class OrganizationUpdaterImplTest { assertThat(dbClient.permissionTemplateDao().selectGroupPermissionsByTemplateId(dbSession, defaultTemplate.getId())) .extracting(PermissionTemplateGroupDto::getGroupId, PermissionTemplateGroupDto::getPermission) .containsOnly( - tuple(ownersGroup.getId(), UserRole.ADMIN), tuple(ownersGroup.getId(), UserRole.ISSUE_ADMIN), tuple(ownersGroup.getId(), UserRole.SECURITYHOTSPOT_ADMIN), + tuple(ownersGroup.getId(), UserRole.ADMIN), tuple(ownersGroup.getId(), GlobalPermissions.SCAN_EXECUTION), - tuple(defaultGroupId, UserRole.USER), tuple(defaultGroupId, UserRole.CODEVIEWER)); + tuple(defaultGroupId, UserRole.USER), + tuple(defaultGroupId, UserRole.CODEVIEWER), + tuple(defaultGroupId, UserRole.ISSUE_ADMIN), + tuple(defaultGroupId, UserRole.SECURITYHOTSPOT_ADMIN)); } @Test @@ -432,11 +435,15 @@ public class OrganizationUpdaterImplTest { assertThat(dbClient.permissionTemplateDao().selectGroupPermissionsByTemplateId(dbSession, defaultTemplate.getId())) .extracting(PermissionTemplateGroupDto::getGroupId, PermissionTemplateGroupDto::getPermission) .containsOnly( - tuple(defaultGroupId, UserRole.USER), tuple(defaultGroupId, UserRole.CODEVIEWER)); + tuple(defaultGroupId, UserRole.USER), + tuple(defaultGroupId, UserRole.CODEVIEWER), + tuple(defaultGroupId, UserRole.ISSUE_ADMIN), + tuple(defaultGroupId, UserRole.SECURITYHOTSPOT_ADMIN)); assertThat(dbClient.permissionTemplateCharacteristicDao().selectByTemplateIds(dbSession, Collections.singletonList(defaultTemplate.getId()))) .extracting(PermissionTemplateCharacteristicDto::getWithProjectCreator, PermissionTemplateCharacteristicDto::getPermission) .containsOnly( - tuple(true, UserRole.ADMIN), tuple(true, UserRole.ISSUE_ADMIN), tuple(true, UserRole.SECURITYHOTSPOT_ADMIN), tuple(true, GlobalPermissions.SCAN_EXECUTION)); + tuple(true, UserRole.ADMIN), + tuple(true, GlobalPermissions.SCAN_EXECUTION)); } @Test diff --git a/server/sonar-server/src/test/java/org/sonar/server/organization/ws/CreateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/organization/ws/CreateActionTest.java index ae0a3265ff4..de8573516a2 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/organization/ws/CreateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/organization/ws/CreateActionTest.java @@ -221,9 +221,12 @@ public class CreateActionTest { assertThat(dbClient.permissionTemplateDao().selectGroupPermissionsByTemplateId(dbSession, defaultTemplate.getId())) .extracting(PermissionTemplateGroupDto::getGroupId, PermissionTemplateGroupDto::getPermission) .containsOnly( - tuple(ownersGroup.getId(), UserRole.ADMIN), tuple(ownersGroup.getId(), UserRole.ISSUE_ADMIN), tuple(ownersGroup.getId(), UserRole.SECURITYHOTSPOT_ADMIN), + tuple(ownersGroup.getId(), UserRole.ADMIN), tuple(ownersGroup.getId(), GlobalPermissions.SCAN_EXECUTION), - tuple(defaultGroup.getId(), UserRole.USER), tuple(defaultGroup.getId(), UserRole.CODEVIEWER)); + tuple(defaultGroup.getId(), UserRole.USER), + tuple(defaultGroup.getId(), UserRole.CODEVIEWER), + tuple(defaultGroup.getId(), UserRole.ISSUE_ADMIN), + tuple(defaultGroup.getId(), UserRole.SECURITYHOTSPOT_ADMIN)); } @Test |