]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8134 remove unused production code from RoleDao
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 17 Oct 2016 13:11:35 +0000 (15:11 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 20 Oct 2016 13:10:12 +0000 (15:10 +0200)
13 files changed:
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ApplyPermissionsStepTest.java
sonar-db/src/main/java/org/sonar/db/permission/UserPermissionDao.java
sonar-db/src/main/java/org/sonar/db/user/RoleDao.java
sonar-db/src/main/java/org/sonar/db/user/RoleMapper.java
sonar-db/src/main/resources/org/sonar/db/user/RoleMapper.xml
sonar-db/src/test/java/org/sonar/db/permission/PermissionRepositoryTest.java
sonar-db/src/test/java/org/sonar/db/permission/UserPermissionDaoTest.java
sonar-db/src/test/java/org/sonar/db/user/RoleDaoTest.java
sonar-db/src/test/java/org/sonar/db/user/UserDaoTest.java
sonar-db/src/test/resources/org/sonar/db/user/RoleDaoTest/globalGroupPermissions-result.xml [deleted file]
sonar-db/src/test/resources/org/sonar/db/user/RoleDaoTest/globalGroupPermissions.xml [deleted file]
sonar-db/src/test/resources/org/sonar/db/user/RoleDaoTest/resourceGroupPermissions-result.xml [deleted file]
sonar-db/src/test/resources/org/sonar/db/user/RoleDaoTest/resourceGroupPermissions.xml [deleted file]

index fd83a6f5682f3a54ac7aead0d622163efea77ade..218446d299d0d2a2a2a9aca4419853484fbf0d65 100644 (file)
@@ -19,6 +19,9 @@
  */
 package org.sonar.server.computation.task.projectanalysis.step;
 
+import java.util.List;
+import java.util.Map;
+import org.elasticsearch.search.SearchHit;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
@@ -107,7 +110,8 @@ public class ApplyPermissionsStepTest extends BaseStepTest {
     dbSession.commit();
 
     assertThat(dbClient.componentDao().selectOrFailByKey(dbSession, ROOT_KEY).getAuthorizationUpdatedAt()).isNotNull();
-    assertThat(dbClient.roleDao().selectGroupPermissions(dbSession, DefaultGroups.ANYONE, projectDto.getId())).containsOnly(UserRole.USER);
+    assertThat(dbClient.groupPermissionDao().selectProjectPermissionsOfGroup(dbSession,
+      dbTester.getDefaultOrganization().getUuid(), null, projectDto.getId())).containsOnly(UserRole.USER);
     authorizationIndexerTester.verifyProjectExistsWithPermission(ROOT_UUID, singletonList(DefaultGroups.ANYONE), emptyList());
   }
 
@@ -148,7 +152,8 @@ public class ApplyPermissionsStepTest extends BaseStepTest {
     dbSession.commit();
 
     assertThat(dbClient.componentDao().selectOrFailByKey(dbSession, ROOT_KEY).getAuthorizationUpdatedAt()).isNotNull();
-    assertThat(dbClient.roleDao().selectGroupPermissions(dbSession, DefaultGroups.ANYONE, viewDto.getId())).containsOnly(permission);
+    assertThat(dbClient.groupPermissionDao().selectProjectPermissionsOfGroup(dbSession,
+      dbTester.getDefaultOrganization().getUuid(), null, viewDto.getId())).containsOnly(permission);
   }
 
   @Test
@@ -170,9 +175,12 @@ public class ApplyPermissionsStepTest extends BaseStepTest {
   }
 
   private void createDefaultPermissionTemplate(String permission) {
-    PermissionTemplateDto permissionTemplateDto = dbClient.permissionTemplateDao().insert(dbSession, newPermissionTemplateDto().setName("Default"));
-    settings.setProperty("sonar.permission.template.default", permissionTemplateDto.getKee());
-    dbClient.permissionTemplateDao().insertGroupPermission(dbSession, permissionTemplateDto.getId(), null, permission);
+    PermissionTemplateDto defaultTemplate = newPermissionTemplateDto()
+      .setOrganizationUuid(dbTester.getDefaultOrganization().getUuid())
+      .setName("Default");
+    dbClient.permissionTemplateDao().insert(dbSession, defaultTemplate);
+    settings.setProperty("sonar.permission.template.default", defaultTemplate.getKee());
+    dbClient.permissionTemplateDao().insertGroupPermission(dbSession, defaultTemplate.getId(), null, permission);
     dbSession.commit();
   }
 
index bb170254026c9d7052f7f10ba2ba1596f07857e2..d7512cb7c115d1586c94adeaa77e2cf2a5f912c3 100644 (file)
@@ -21,7 +21,6 @@ package org.sonar.db.permission;
 
 import java.util.Collection;
 import java.util.List;
-import java.util.Set;
 import java.util.stream.Collectors;
 import javax.annotation.Nullable;
 import org.apache.ibatis.session.RowBounds;
@@ -30,7 +29,6 @@ import org.sonar.db.DatabaseUtils;
 import org.sonar.db.DbSession;
 
 import static com.google.common.base.Preconditions.checkArgument;
-import static java.util.Arrays.asList;
 import static java.util.Collections.emptyList;
 import static org.sonar.db.DatabaseUtils.executeLargeInputs;
 
@@ -61,22 +59,6 @@ public class UserPermissionDao implements Dao {
       .collect(Collectors.toList());
   }
 
-  /**
-   * Shortcut over {@link #select(DbSession, PermissionQuery, Collection)}
-   * @param userLogin the non-null user login
-   * @param projectUuid if null, then return global permissions, else return permissions of user on this project
-   */
-  public Set<String> selectPermissionsByLogin(DbSession dbSession, String userLogin, @Nullable String projectUuid) {
-    PermissionQuery query = PermissionQuery.builder()
-      .withAtLeastOnePermission()
-      .setComponentUuid(projectUuid)
-      .build();
-    return select(dbSession, query, asList(userLogin)).stream()
-      .map(ExtendedUserPermissionDto::getPermission)
-      .collect(Collectors.toSet());
-  }
-
-
   /**
    * @see UserPermissionMapper#countUsersByQuery(PermissionQuery, Collection)
    */
index cfd6a2ea69c143fea9c499f06a14c3c7dcab3391..766322ecd5c5325bd0ff21501d772d2dbfe27a5e 100644 (file)
@@ -20,8 +20,6 @@
 package org.sonar.db.user;
 
 import java.util.List;
-import javax.annotation.Nullable;
-import org.sonar.api.security.DefaultGroups;
 import org.sonar.db.Dao;
 import org.sonar.db.DbSession;
 
@@ -35,28 +33,10 @@ public class RoleDao implements Dao {
     return mapper(dbSession).selectComponentIdsByPermissionAndUserId(permission, userId);
   }
 
-  /**
-   * @deprecated replaced by {@link org.sonar.db.permission.GroupPermissionDao#selectGroupPermissions(DbSession, long, Long)}
-   * and {@link org.sonar.db.permission.GroupPermissionDao#selectAnyonePermissions(DbSession, Long)}
-   */
-  @Deprecated
-  public List<String> selectGroupPermissions(DbSession session, String groupName, @Nullable Long resourceId) {
-    return session.getMapper(RoleMapper.class).selectGroupPermissions(groupName, resourceId, DefaultGroups.isAnyone(groupName));
-  }
-
-
   public void deleteGroupRolesByGroupId(DbSession session, long groupId) {
     mapper(session).deleteGroupRolesByGroupId(groupId);
   }
 
-  /**
-   * @deprecated does not support organizations
-   */
-  @Deprecated
-  public int countUserPermissions(DbSession session, String permission, @Nullable Long allGroupsExceptThisGroupId) {
-    return mapper(session).countUsersWithPermission(permission, allGroupsExceptThisGroupId);
-  }
-
   private static RoleMapper mapper(DbSession session) {
     return session.getMapper(RoleMapper.class);
   }
index eae65a9bf340e5e9659f3a58bbf3772421ab883a..963aa4466e7d414609d2f257cd46c5970d1a6f43 100644 (file)
 package org.sonar.db.user;
 
 import java.util.List;
-import javax.annotation.Nullable;
 import org.apache.ibatis.annotations.Param;
 
-/**
- * @since 3.2
- */
 public interface RoleMapper {
 
   List<Long> selectComponentIdsByPermissionAndUserId(@Param("permission") String permission, @Param("userId") long userId);
 
-  /**
-   * @return permissions from to a group
-   */
-  List<String> selectGroupPermissions(@Param("groupName") String groupName, @Nullable @Param("resourceId") Long resourceId, @Param("isAnyOneGroup") Boolean isAnyOneGroup);
-
   void deleteGroupRolesByGroupId(long groupId);
 
-  int countUsersWithPermission(@Param("permission") String permission, @Nullable @Param("groupId") Long groupId);
 }
index 766ae4a6bf7f285e5c86b713bf9ec12ce8a1984b..98d5c9cc52087a83f2f3dc7d2c5a0b301426a041 100644 (file)
     ORDER by resource_id
   </select>
 
-  <select id="selectGroupPermissions" parameterType="map" resultType="String">
-    SELECT gr.role
-    FROM group_roles gr
-    <if test="isAnyOneGroup != true">
-      INNER JOIN groups g ON g.id = gr.group_id
-    </if>
-    <where>
-      <choose>
-        <when test="isAnyOneGroup != true">
-          AND g.name = #{groupName}
-        </when>
-        <otherwise>
-          AND gr.group_id IS NULL
-        </otherwise>
-      </choose>
-      <choose>
-        <when test="resourceId != null">
-          AND resource_id=#{resourceId}
-        </when>
-        <otherwise>
-          AND resource_id IS NULL
-        </otherwise>
-      </choose>
-    </where>
-  </select>
-
-  <select id="countUsersWithPermission" parameterType="map" resultType="int">
-    SELECT count(c.id)
-    FROM (
-    SELECT DISTINCT ur.user_id as id
-    FROM user_roles ur
-    INNER JOIN users u ON u.id=ur.user_id AND u.active=${_true}
-    WHERE
-    ur.role = #{permission} and ur.resource_id IS NULL
-    UNION ALL
-    SELECT DISTINCT u.id as id
-    FROM users u
-    INNER JOIN groups_users gu ON gu.user_id = u.id
-    INNER JOIN group_roles gr ON gr.group_id = gu.group_id
-    INNER JOIN groups g ON g.id = gu.group_id
-    WHERE
-    gr.role = #{permission}
-    AND gr.resource_id IS NULL
-    AND u.active=${_true}
-    <if test="groupId!=null">
-      AND g.id!=#{groupId}
-    </if>
-    ) c
-  </select>
-
   <delete id="deleteGroupRolesByGroupId" parameterType="long">
     delete from group_roles where group_id=#{id}
   </delete>
index 5d7247fd90a49a7028eaaef957ee4f6740134af6..ab0436797c695e7e80d378e5f1277b8b08641dd6 100644 (file)
@@ -19,6 +19,7 @@
  */
 package org.sonar.db.permission;
 
+import java.util.List;
 import javax.annotation.Nullable;
 import org.junit.Before;
 import org.junit.Rule;
@@ -35,7 +36,6 @@ import org.sonar.db.component.ComponentDto;
 import org.sonar.db.permission.template.PermissionTemplateDbTester;
 import org.sonar.db.permission.template.PermissionTemplateDto;
 import org.sonar.db.user.GroupDto;
-import org.sonar.db.user.RoleDao;
 import org.sonar.db.user.UserDto;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -73,24 +73,32 @@ public class PermissionRepositoryTest {
   public void apply_permission_template() {
     dbTester.prepareDbUnit(getClass(), "should_apply_permission_template.xml");
 
-    UserDto marius = dbTester.users().selectUserByLogin("marius").get();
-    RoleDao roleDao = dbTester.getDbClient().roleDao();
-    assertThat(roleDao.selectGroupPermissions(session, "sonar-administrators", PROJECT.getId())).isEmpty();
-    assertThat(roleDao.selectGroupPermissions(session, "sonar-users", PROJECT.getId())).isEmpty();
-    assertThat(roleDao.selectGroupPermissions(session, "Anyone", PROJECT.getId())).isEmpty();
-    assertThat(dbTester.getDbClient().userPermissionDao().selectProjectPermissionsOfUser(session, marius.getId(), PROJECT.getId())).isEmpty();
+    assertThat(selectProjectPermissionsOfGroup("org1", 100L, PROJECT)).isEmpty();
+    assertThat(selectProjectPermissionsOfGroup("org1", 101L, PROJECT)).isEmpty();
+    assertThat(selectProjectPermissionsOfGroup("org1", null, PROJECT)).isEmpty();
+    assertThat(selectProjectPermissionsOfUser(200L, PROJECT)).isEmpty();
 
     PermissionTemplateDto template = dbTester.getDbClient().permissionTemplateDao().selectByUuid(session, "default_20130101_010203");
     underTest.apply(session, template, PROJECT, null);
 
-    assertThat(roleDao.selectGroupPermissions(session, "sonar-administrators", PROJECT.getId())).containsOnly("admin", "issueadmin");
-    assertThat(roleDao.selectGroupPermissions(session, "sonar-users", PROJECT.getId())).containsOnly("user", "codeviewer");
-    assertThat(roleDao.selectGroupPermissions(session, "Anyone", PROJECT.getId())).containsOnly("user", "codeviewer");
-    assertThat(dbTester.getDbClient().userPermissionDao().selectProjectPermissionsOfUser(session, marius.getId(), PROJECT.getId())).containsOnly("admin");
+    assertThat(selectProjectPermissionsOfGroup("org1", 100L, PROJECT)).containsOnly("admin", "issueadmin");
+    assertThat(selectProjectPermissionsOfGroup("org1", 101L, PROJECT)).containsOnly("user", "codeviewer");
+    assertThat(selectProjectPermissionsOfGroup("org1", null, PROJECT)).containsOnly("user", "codeviewer");
+    assertThat(selectProjectPermissionsOfUser(200L, PROJECT)).containsOnly("admin");
 
     checkAuthorizationUpdatedAtIsUpdated();
   }
 
+  private List<String> selectProjectPermissionsOfGroup(String organizationUuid, @Nullable Long groupId, ComponentDto project) {
+    return dbTester.getDbClient().groupPermissionDao().selectProjectPermissionsOfGroup(session,
+      organizationUuid, groupId != null ? groupId : null, project.getId());
+  }
+
+  private List<String> selectProjectPermissionsOfUser(long userId, ComponentDto project) {
+    return dbTester.getDbClient().userPermissionDao().selectProjectPermissionsOfUser(session,
+      userId, project.getId());
+  }
+
   @Test
   public void apply_default_permission_template_from_component_id() {
     dbTester.prepareDbUnit(getClass(), "apply_default_permission_template_by_component_id.xml");
index 8cfe4d3c5bccd93ce9cc98d3efb01f74857b031f..4210dd4b5a0d4c1ffe4b1a158d717bb575cbf2b9 100644 (file)
@@ -226,29 +226,6 @@ public class UserPermissionDaoTest {
     assertThat(underTest.selectLogins(dbSession, query)).isEmpty();
   }
 
-  @Test
-  public void selectPermissionsByLogin() {
-    addGlobalPermissionOnDefaultOrganization(SYSTEM_ADMIN, user1);
-    addProjectPermissionOnDefaultOrganization(USER, user1, project1);
-    addProjectPermissionOnDefaultOrganization(USER, user2, project1);
-    addProjectPermissionOnDefaultOrganization(ISSUE_ADMIN, user2, project1);
-    addProjectPermissionOnDefaultOrganization(ISSUE_ADMIN, user2, project2);
-
-    // user1 has one global permission and user2 has no global permissions
-    assertThat(underTest.selectPermissionsByLogin(dbSession, user1.getLogin(), null)).hasSize(1);
-    assertThat(underTest.selectPermissionsByLogin(dbSession, user2.getLogin(), null)).hasSize(0);
-
-    // user1 has one permission on project1, user2 has 2
-    assertThat(underTest.selectPermissionsByLogin(dbSession, user1.getLogin(), project1.uuid())).hasSize(1);
-    assertThat(underTest.selectPermissionsByLogin(dbSession, user2.getLogin(), project1.uuid())).hasSize(2);
-
-    // nobody has permissions on a project that does not exist!
-    assertThat(underTest.selectPermissionsByLogin(dbSession, user1.getLogin(), "missing")).hasSize(0);
-
-    // users who do not exist don't have permissions!
-    assertThat(underTest.selectPermissionsByLogin(dbSession, "missing", null)).hasSize(0);
-  }
-
   @Test
   public void deleteGlobalPermission() {
     addGlobalPermissionOnDefaultOrganization("perm1", user1);
index 08a880b03c6766efeeaf6e99ace8e7f161d80b9a..52cfd71a5933b9cd7f145df8788f894ff4a3a721 100644 (file)
@@ -23,7 +23,6 @@ import java.util.List;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
-import org.sonar.api.security.DefaultGroups;
 import org.sonar.api.utils.System2;
 import org.sonar.api.web.UserRole;
 import org.sonar.core.permission.GlobalPermissions;
@@ -94,28 +93,6 @@ public class RoleDaoTest {
     assertThat(result).containsExactly(project1.getId(), project2.getId());
   }
 
-  @Test
-  public void retrieve_global_group_permissions() {
-    db.prepareDbUnit(getClass(), "globalGroupPermissions.xml");
-
-    assertThat(underTest.selectGroupPermissions(db.getSession(), "sonar-administrators", null)).containsOnly(GlobalPermissions.SYSTEM_ADMIN,
-      GlobalPermissions.QUALITY_PROFILE_ADMIN,
-      GlobalPermissions.QUALITY_GATE_ADMIN);
-    assertThat(underTest.selectGroupPermissions(db.getSession(), "sonar-users", null)).containsOnly(GlobalPermissions.QUALITY_GATE_ADMIN);
-    assertThat(underTest.selectGroupPermissions(db.getSession(), DefaultGroups.ANYONE, null)).containsOnly(GlobalPermissions.PROVISIONING,
-      GlobalPermissions.SCAN_EXECUTION);
-    assertThat(underTest.selectGroupPermissions(db.getSession(), "anyone", null)).containsOnly(GlobalPermissions.PROVISIONING, GlobalPermissions.SCAN_EXECUTION);
-    assertThat(underTest.selectGroupPermissions(db.getSession(), "AnYoNe", null)).containsOnly(GlobalPermissions.PROVISIONING, GlobalPermissions.SCAN_EXECUTION);
-  }
-
-  @Test
-  public void retrieve_resource_group_permissions() {
-    db.prepareDbUnit(getClass(), "resourceGroupPermissions.xml");
-
-    assertThat(underTest.selectGroupPermissions(db.getSession(), "sonar-administrators", 1L)).containsOnly(UserRole.ADMIN, UserRole.CODEVIEWER);
-    assertThat(underTest.selectGroupPermissions(db.getSession(), "sonar-users", 1L)).containsOnly(UserRole.CODEVIEWER);
-  }
-
   @Test
   public void delete_all_group_permissions_by_group_id() {
     db.prepareDbUnit(getClass(), "deleteGroupPermissionsByGroupId.xml");
@@ -125,40 +102,4 @@ public class RoleDaoTest {
 
     db.assertDbUnit(getClass(), "deleteGroupPermissionsByGroupId-result.xml", "group_roles");
   }
-
-  @Test
-  public void countUserPermissions() {
-    db.users().insertProjectPermissionOnUser(user1, GlobalPermissions.SYSTEM_ADMIN, project1);
-    db.users().insertPermissionOnUser(user1, GlobalPermissions.SYSTEM_ADMIN);
-    db.users().insertPermissionOnUser(user1, GlobalPermissions.SCAN_EXECUTION);
-
-    int result = underTest.countUserPermissions(db.getSession(), GlobalPermissions.SYSTEM_ADMIN, null);
-
-    assertThat(result).isEqualTo(1);
-  }
-
-  @Test
-  public void countUserPermissions_counts_users_with_one_permission_when_the_last_one_is_in_a_group() {
-    GroupDto group1 = db.users().insertGroup(newGroupDto());
-    db.users().insertMember(group1, user1);
-    db.users().insertPermissionOnGroup(group1, GlobalPermissions.SYSTEM_ADMIN);
-
-    int resultWithoutExcludingGroup = underTest.countUserPermissions(db.getSession(), GlobalPermissions.SYSTEM_ADMIN, null);
-    assertThat(resultWithoutExcludingGroup).isEqualTo(1);
-
-    int resultWithGroupExclusion = underTest.countUserPermissions(db.getSession(), GlobalPermissions.SYSTEM_ADMIN, group1.getId());
-    assertThat(resultWithGroupExclusion).isEqualTo(0);
-  }
-
-  @Test
-  public void countUserPermissions_counts_user_twice_when_both_user_and_group_permission() {
-    GroupDto group1 = db.users().insertGroup(newGroupDto());
-    db.users().insertMember(group1, user1);
-    db.users().insertPermissionOnGroup(group1, GlobalPermissions.SYSTEM_ADMIN);
-    db.users().insertPermissionOnUser(user1, GlobalPermissions.SYSTEM_ADMIN);
-
-    int result = underTest.countUserPermissions(db.getSession(), GlobalPermissions.SYSTEM_ADMIN, null);
-
-    assertThat(result).isEqualTo(2);
-  }
 }
index 35eca3f53c1dbe5b31afd9ea79e52cdb6075c948..dc1114eef2f19841863c727358977a3f03fcf826 100644 (file)
@@ -407,7 +407,7 @@ public class UserDaoTest {
     MeasureFilterDto measureFilter = insertMeasureFilter(user, false);
     MeasureFilterFavouriteDto measureFilterFavourite = insertMeasureFilterFavourite(measureFilter, user);
     PropertyDto property = insertProperty(user);
-    insertUserPermission(user);
+    db.users().insertPermissionOnUser(user, "perm");
     insertUserGroup(user);
 
     UserDto otherUser = newActiveUser();
@@ -437,7 +437,7 @@ public class UserDaoTest {
     assertThat(dbClient.measureFilterDao().selectById(session, measureFilter.getId())).isNull();
     assertThat(dbClient.measureFilterFavouriteDao().selectById(session, measureFilterFavourite.getId())).isNull();
     assertThat(dbClient.propertiesDao().selectByQuery(PropertyQuery.builder().setKey(property.getKey()).build(), session)).isEmpty();
-    assertThat(dbClient.userPermissionDao().selectPermissionsByLogin(session, user.getLogin(), null)).isEmpty();
+    assertThat(dbClient.userPermissionDao().selectGlobalPermissionsOfUser(session, user.getId(), db.getDefaultOrganization().getUuid())).isEmpty();
     assertThat(dbClient.groupMembershipDao().countGroups(session, builder().login(user.getLogin()).membership(IN).build(), user.getId())).isZero();
   }
 
@@ -836,13 +836,6 @@ public class UserDaoTest {
     return dto;
   }
 
-  private org.sonar.db.permission.UserPermissionDto insertUserPermission(UserDto user) {
-    String permission = randomAlphanumeric(64);
-    UserPermissionDto dto = new UserPermissionDto(db.getDefaultOrganization().getUuid(), permission, user.getId(), null);
-    dbClient.userPermissionDao().insert(session, dto);
-    return dto;
-  }
-
   private UserGroupDto insertUserGroup(UserDto user) {
     GroupDto group = newGroupDto().setName(randomAlphanumeric(30));
     dbClient.groupDao().insert(session, group);
diff --git a/sonar-db/src/test/resources/org/sonar/db/user/RoleDaoTest/globalGroupPermissions-result.xml b/sonar-db/src/test/resources/org/sonar/db/user/RoleDaoTest/globalGroupPermissions-result.xml
deleted file mode 100644 (file)
index cdf185a..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<dataset>
-
-  <groups id="100"
-          name="sonar-administrators"
-          organization_uuid="org1"/>
-  <groups id="101"
-          name="sonar-users"
-          organization_uuid="org1"/>
-
-  <group_roles id="1"
-               group_id="100"
-               role="admin"
-               resource_id="[null]"
-               organization_uuid="org1"/>
-  <group_roles id="3"
-               group_id="100"
-               role="gateadmin"
-               resource_id="[null]"
-               organization_uuid="org1"/>
-  <group_roles id="4"
-               group_id="101"
-               role="gateadmin"
-               resource_id="[null]"
-               organization_uuid="org1"/>
-
-  <!-- Group 'anyone' has a NULL group_id -->
-  <group_roles id="5"
-               group_id="[null]"
-               role="scan"
-               resource_id="[null]"
-               organization_uuid="org1"/>
-  <group_roles id="6"
-               group_id="[null]"
-               role="provisioning"
-               resource_id="[null]"
-               organization_uuid="org1"/>
-
-  <group_roles id="7"
-               group_id="102"
-               role="admin"
-               resource_id="1"
-               organization_uuid="org1"/>
-
-</dataset>
diff --git a/sonar-db/src/test/resources/org/sonar/db/user/RoleDaoTest/globalGroupPermissions.xml b/sonar-db/src/test/resources/org/sonar/db/user/RoleDaoTest/globalGroupPermissions.xml
deleted file mode 100644 (file)
index 570c81e..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-<dataset>
-
-  <groups id="100"
-          name="sonar-administrators"
-          organization_uuid="org1"/>
-  <groups id="101"
-          name="sonar-users"
-          organization_uuid="org1"/>
-
-  <group_roles id="1"
-               group_id="100"
-               role="admin"
-               resource_id="[null]"
-               organization_uuid="org1"/>
-  <group_roles id="2"
-               group_id="100"
-               role="profileadmin"
-               resource_id="[null]"
-               organization_uuid="org1"/>
-  <group_roles id="3"
-               group_id="100"
-               role="gateadmin"
-               resource_id="[null]"
-               organization_uuid="org1"/>
-  <group_roles id="4"
-               group_id="101"
-               role="gateadmin"
-               resource_id="[null]"
-               organization_uuid="org1"/>
-
-  <!-- Group 'anyone' has a NULL group_id -->
-  <group_roles id="5"
-               group_id="[null]"
-               role="scan"
-               resource_id="[null]"
-               organization_uuid="org1"/>
-  <group_roles id="6"
-               group_id="[null]"
-               role="provisioning"
-               resource_id="[null]"
-               organization_uuid="org1"/>
-
-  <!-- Component permission, it should not be returned with global permissions -->
-  <group_roles id="7"
-               group_id="102"
-               role="admin"
-               resource_id="1"
-               organization_uuid="org1"/>
-
-</dataset>
diff --git a/sonar-db/src/test/resources/org/sonar/db/user/RoleDaoTest/resourceGroupPermissions-result.xml b/sonar-db/src/test/resources/org/sonar/db/user/RoleDaoTest/resourceGroupPermissions-result.xml
deleted file mode 100644 (file)
index 3c41ea6..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<dataset>
-
-  <groups id="100"
-          name="sonar-administrators"
-          organization_uuid="org1"/>
-  <groups id="101"
-          name="sonar-users"
-          organization_uuid="org1"/>
-
-  <group_roles id="1"
-               group_id="100"
-               role="admin"
-               resource_id="1"
-               organization_uuid="org1"/>
-  <group_roles id="3"
-               group_id="101"
-               role="codeviewer"
-               resource_id="1"
-               organization_uuid="org1"/>
-
-  <!-- Group 'anyone' has a NULL group_id -->
-  <group_roles id="4"
-               group_id="[null]"
-               role="user"
-               resource_id="1"
-               organization_uuid="org1"/>
-
-  <group_roles id="5"
-               group_id="100"
-               role="admin"
-               resource_id="[null]"
-               organization_uuid="org1"/>
-
-</dataset>
diff --git a/sonar-db/src/test/resources/org/sonar/db/user/RoleDaoTest/resourceGroupPermissions.xml b/sonar-db/src/test/resources/org/sonar/db/user/RoleDaoTest/resourceGroupPermissions.xml
deleted file mode 100644 (file)
index 569141d..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<dataset>
-
-  <groups id="100"
-          name="sonar-administrators"
-          organization_uuid="org1"/>
-  <groups id="101"
-          name="sonar-users"
-          organization_uuid="org1"/>
-
-  <group_roles id="1"
-               group_id="100"
-               role="admin"
-               resource_id="1"
-               organization_uuid="org1"/>
-  <group_roles id="2"
-               group_id="100"
-               role="codeviewer"
-               resource_id="1"
-               organization_uuid="org1"/>
-  <group_roles id="3"
-               group_id="101"
-               role="codeviewer"
-               resource_id="1"
-               organization_uuid="org1"/>
-
-  <!-- Group 'anyone' has a NULL group_id -->
-  <group_roles id="4"
-               group_id="[null]"
-               role="user"
-               resource_id="1"
-               organization_uuid="org1"/>
-
-  <!-- Global permission, it should not be returned with component permissions -->
-  <group_roles id="5"
-               group_id="100"
-               role="admin"
-               resource_id="[null]"
-               organization_uuid="org1"/>
-
-</dataset>