aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-11-08 17:04:22 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2012-11-08 17:04:22 +0100
commit929a72a19587e5e06018e04c47ac525f033b333c (patch)
tree0a6103d769518848054fa64481842db72e0743c2 /plugins
parentcee7f854a3d1403ad605c9aef560d3cbd27095eb (diff)
downloadsonarqube-929a72a19587e5e06018e04c47ac525f033b333c.tar.gz
sonarqube-929a72a19587e5e06018e04c47ac525f033b333c.zip
Grant roles when projects are created, not later during decorator phase
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java2
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/security/DefaultResourcePermissions.java156
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/security/DefaultResourcePermissionsTest.java154
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles-result.xml20
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles.xml10
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles_unknown_group-result.xml16
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles_unknown_group.xml10
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles_users-result.xml16
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles_users.xml11
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole-result.xml6
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole.xml4
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_anyone-result.xml6
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_anyone.xml4
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_ignore_if_group_not_found-result.xml7
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_ignore_if_group_not_found.xml7
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_ignore_if_not_persisted-result.xml7
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_ignore_if_not_persisted.xml7
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantUserRole-result.xml6
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantUserRole.xml3
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/hasRoles.xml16
20 files changed, 0 insertions, 468 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
index a3c2ff3561b..b7a2f0f003d 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
@@ -46,7 +46,6 @@ import org.sonar.plugins.core.filters.MyFavouritesFilter;
import org.sonar.plugins.core.filters.ProjectFilter;
import org.sonar.plugins.core.filters.TreeMapFilter;
import org.sonar.plugins.core.security.ApplyProjectRolesDecorator;
-import org.sonar.plugins.core.security.DefaultResourcePermissions;
import org.sonar.plugins.core.sensors.BranchCoverageDecorator;
import org.sonar.plugins.core.sensors.CheckAlertThresholds;
import org.sonar.plugins.core.sensors.CommentDensityDecorator;
@@ -475,7 +474,6 @@ public final class CorePlugin extends SonarPlugin {
OverallLineCoverageDecorator.class,
OverallCoverageDecorator.class,
OverallBranchCoverageDecorator.class,
- DefaultResourcePermissions.class,
ApplyProjectRolesDecorator.class,
ExcludedResourceFilter.class,
CommentDensityDecorator.class,
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/security/DefaultResourcePermissions.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/security/DefaultResourcePermissions.java
deleted file mode 100644
index 1a3e9e21e46..00000000000
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/security/DefaultResourcePermissions.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2012 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.plugins.core.security;
-
-import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.BatchExtension;
-import org.sonar.api.ServerExtension;
-import org.sonar.api.config.Settings;
-import org.sonar.api.resources.Resource;
-import org.sonar.api.security.DefaultGroups;
-import org.sonar.api.security.ResourcePermissions;
-import org.sonar.api.web.UserRole;
-import org.sonar.core.persistence.MyBatis;
-import org.sonar.core.user.*;
-
-/**
- * @since 3.2
- */
-public class DefaultResourcePermissions implements ResourcePermissions, BatchExtension, ServerExtension {
-
- private final Settings settings;
- private final MyBatis myBatis;
-
- public DefaultResourcePermissions(Settings settings, MyBatis myBatis) {
- this.settings = settings;
- this.myBatis = myBatis;
- }
-
- public boolean hasRoles(Resource resource) {
- if (resource.getId() != null) {
- SqlSession session = myBatis.openSession();
- try {
- RoleMapper roleMapper = session.getMapper(RoleMapper.class);
- Long resourceId = Long.valueOf(resource.getId());
- return roleMapper.countGroupRoles(resourceId) + roleMapper.countUserRoles(resourceId) > 0;
-
- } finally {
- MyBatis.closeQuietly(session);
- }
- }
- return false;
- }
-
- public void grantUserRole(Resource resource, String login, String role) {
- if (resource.getId() != null) {
- SqlSession session = myBatis.openSession();
- try {
- UserDto user = session.getMapper(UserMapper.class).selectUserByLogin(login);
- if (user != null) {
- UserRoleDto userRole = new UserRoleDto()
- .setRole(role)
- .setUserId(user.getId())
- .setResourceId(Long.valueOf(resource.getId()));
- RoleMapper roleMapper = session.getMapper(RoleMapper.class);
- roleMapper.deleteUserRole(userRole);
- roleMapper.insertUserRole(userRole);
- session.commit();
- }
- } finally {
- MyBatis.closeQuietly(session);
- }
- }
- }
-
- public void grantGroupRole(Resource resource, String groupName, String role) {
- if (resource.getId() != null) {
- SqlSession session = myBatis.openSession();
- try {
- GroupRoleDto groupRole = new GroupRoleDto()
- .setRole(role)
- .setResourceId(Long.valueOf(resource.getId()));
- RoleMapper roleMapper = session.getMapper(RoleMapper.class);
- if (DefaultGroups.isAnyone(groupName)) {
- roleMapper.deleteGroupRole(groupRole);
- roleMapper.insertGroupRole(groupRole);
- session.commit();
- } else {
- GroupDto group = session.getMapper(UserMapper.class).selectGroupByName(groupName);
- if (group != null) {
- groupRole.setGroupId(group.getId());
- roleMapper.deleteGroupRole(groupRole);
- roleMapper.insertGroupRole(groupRole);
- session.commit();
- }
- }
- } finally {
- MyBatis.closeQuietly(session);
- }
- }
- }
-
- public void grantDefaultRoles(Resource resource) {
- if (resource.getId() != null) {
- SqlSession session = myBatis.openSession();
- try {
- removeRoles(resource, session);
- grantDefaultRoles(resource, UserRole.ADMIN, session);
- grantDefaultRoles(resource, UserRole.USER, session);
- grantDefaultRoles(resource, UserRole.CODEVIEWER, session);
- session.commit();
- } finally {
- MyBatis.closeQuietly(session);
- }
- }
- }
-
- private void removeRoles(Resource resource, SqlSession session) {
- Long resourceId = Long.valueOf(resource.getId());
- RoleMapper mapper = session.getMapper(RoleMapper.class);
- mapper.deleteGroupRolesByResourceId(resourceId);
- mapper.deleteUserRolesByResourceId(resourceId);
- }
-
- private void grantDefaultRoles(Resource resource, String role, SqlSession session) {
- UserMapper userMapper = session.getMapper(UserMapper.class);
- RoleMapper roleMapper = session.getMapper(RoleMapper.class);
-
- String[] groupNames = settings.getStringArrayBySeparator("sonar.role." + role + "." + resource.getQualifier() + ".defaultGroups", ",");
- for (String groupName : groupNames) {
- GroupRoleDto groupRole = new GroupRoleDto().setRole(role).setResourceId(Long.valueOf(resource.getId()));
- if (DefaultGroups.isAnyone(groupName)) {
- roleMapper.insertGroupRole(groupRole);
- } else {
- GroupDto group = userMapper.selectGroupByName(groupName);
- if (group != null) {
- roleMapper.insertGroupRole(groupRole.setGroupId(group.getId()));
- }
- }
- }
-
- String[] logins = settings.getStringArrayBySeparator("sonar.role." + role + "." + resource.getQualifier() + ".defaultUsers", ",");
- for (String login : logins) {
- UserDto user = userMapper.selectUserByLogin(login);
- if (user != null) {
- roleMapper.insertUserRole(new UserRoleDto().setRole(role).setUserId(user.getId()).setResourceId(Long.valueOf(resource.getId())));
- }
- }
- }
-}
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/security/DefaultResourcePermissionsTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/security/DefaultResourcePermissionsTest.java
deleted file mode 100644
index 9d098414fbb..00000000000
--- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/security/DefaultResourcePermissionsTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2012 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.plugins.core.security;
-
-import org.junit.Test;
-import org.sonar.api.config.Settings;
-import org.sonar.api.resources.Project;
-import org.sonar.api.resources.Resource;
-import org.sonar.api.security.DefaultGroups;
-import org.sonar.core.persistence.AbstractDaoTestCase;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class DefaultResourcePermissionsTest extends AbstractDaoTestCase {
-
- private Resource project = new Project("project").setId(123);
-
- @Test
- public void grantGroupRole() {
- setupData("grantGroupRole");
-
- DefaultResourcePermissions permissions = new DefaultResourcePermissions(new Settings(), getMyBatis());
- permissions.grantGroupRole(project, "sonar-administrators", "admin");
-
- // do not insert duplicated rows
- permissions.grantGroupRole(project, "sonar-administrators", "admin");
-
- checkTables("grantGroupRole", new String[] {"id"}, "group_roles");
- }
-
- @Test
- public void grantGroupRole_anyone() {
- setupData("grantGroupRole_anyone");
-
- DefaultResourcePermissions permissions = new DefaultResourcePermissions(new Settings(), getMyBatis());
- permissions.grantGroupRole(project, DefaultGroups.ANYONE, "admin");
-
- checkTables("grantGroupRole_anyone", "group_roles");
- }
-
- @Test
- public void grantGroupRole_ignore_if_group_not_found() {
- setupData("grantGroupRole_ignore_if_group_not_found");
-
- DefaultResourcePermissions permissions = new DefaultResourcePermissions(new Settings(), getMyBatis());
- permissions.grantGroupRole(project, "not_found", "admin");
-
- checkTables("grantGroupRole_ignore_if_group_not_found", "group_roles");
- }
-
- @Test
- public void grantGroupRole_ignore_if_not_persisted() {
- setupData("grantGroupRole_ignore_if_not_persisted");
-
- DefaultResourcePermissions permissions = new DefaultResourcePermissions(new Settings(), getMyBatis());
- Project resourceWithoutId = new Project("");
- permissions.grantGroupRole(resourceWithoutId, "sonar-users", "admin");
-
- checkTables("grantGroupRole_ignore_if_not_persisted", "group_roles");
- }
-
- @Test
- public void grantUserRole() {
- setupData("grantUserRole");
-
- DefaultResourcePermissions permissions = new DefaultResourcePermissions(new Settings(), getMyBatis());
- permissions.grantUserRole(project, "marius", "admin");
-
- // do not insert duplicated rows
- permissions.grantUserRole(project, "marius", "admin");
-
- checkTables("grantUserRole", new String[] {"id"}, "user_roles");
- }
-
- @Test
- public void grantDefaultRoles() {
- setupData("grantDefaultRoles");
-
- Settings settings = new Settings();
- settings.setProperty("sonar.role.admin.TRK.defaultGroups", "sonar-administrators");
- settings.setProperty("sonar.role.admin.TRK.defaultUsers", "");
- settings.setProperty("sonar.role.user.TRK.defaultGroups", "Anyone,sonar-users");
- settings.setProperty("sonar.role.user.TRK.defaultUsers", "");
- settings.setProperty("sonar.role.codeviewer.TRK.defaultGroups", "Anyone,sonar-users");
- settings.setProperty("sonar.role.codeviewer.TRK.defaultUsers", "");
- DefaultResourcePermissions permissions = new DefaultResourcePermissions(settings, getMyBatis());
-
- permissions.grantDefaultRoles(project);
-
- checkTables("grantDefaultRoles", "user_roles", "group_roles");
- }
-
- @Test
- public void grantDefaultRoles_unknown_group() {
- setupData("grantDefaultRoles_unknown_group");
-
- Settings settings = new Settings();
- settings.setProperty("sonar.role.admin.TRK.defaultGroups", "sonar-administrators,unknown");
- DefaultResourcePermissions permissions = new DefaultResourcePermissions(settings, getMyBatis());
- permissions.grantDefaultRoles(project);
-
- checkTables("grantDefaultRoles_unknown_group", "group_roles");
- }
-
- @Test
- public void grantDefaultRoles_users() {
- setupData("grantDefaultRoles_users");
-
- Settings settings = new Settings();
- settings.setProperty("sonar.role.admin.TRK.defaultUsers", "marius,disabled,notfound");
- DefaultResourcePermissions permissions = new DefaultResourcePermissions(settings, getMyBatis());
- permissions.grantDefaultRoles(project);
-
- checkTables("grantDefaultRoles_users", "user_roles");
- }
-
- @Test
- public void hasRoles() {
- setupData("hasRoles");
- DefaultResourcePermissions permissions = new DefaultResourcePermissions(new Settings(), getMyBatis());
-
- // no groups and at least one user
- assertThat(permissions.hasRoles(new Project("only_users").setId(1))).isTrue();
-
- // no users and at least one group
- assertThat(permissions.hasRoles(new Project("only_groups").setId(2))).isTrue();
-
- // groups and users
- assertThat(permissions.hasRoles(new Project("groups_and_users").setId(3))).isTrue();
-
- // no groups, no users
- assertThat(permissions.hasRoles(new Project("no_groups_no_users").setId(4))).isFalse();
-
- // does not exist
- assertThat(permissions.hasRoles(new Project("not_found"))).isFalse();
- }
-}
diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles-result.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles-result.xml
deleted file mode 100644
index f4154d15024..00000000000
--- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles-result.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<dataset>
- <groups id="100" name="sonar-administrators"/>
- <groups id="101" name="sonar-users"/>
- <users id="200" login="marius" name="Marius" email="[null]" active="[true]"/>
-
- <!-- on other resources -->
- <group_roles id="1" group_id="100" resource_id="1" role="admin"/>
- <group_roles id="2" group_id="101" resource_id="1" role="user"/>
- <user_roles id="1" user_id="200" resource_id="1" role="admin"/>
-
- <!--
- new rows : sonar-administrators (admin), sonar-users (user & codeviewer), Anyone (user & codeviewer),
- -->
- <group_roles id="3" group_id="100" resource_id="123" role="admin"/>
- <group_roles id="4" group_id="[null]" resource_id="123" role="user"/>
- <group_roles id="5" group_id="101" resource_id="123" role="user"/>
- <group_roles id="6" group_id="[null]" resource_id="123" role="codeviewer"/>
- <group_roles id="7" group_id="101" resource_id="123" role="codeviewer"/>
-
-</dataset> \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles.xml
deleted file mode 100644
index 21a4dda2ccf..00000000000
--- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<dataset>
- <groups id="100" name="sonar-administrators" />
- <groups id="101" name="sonar-users" />
- <users id="200" login="marius" name="Marius" email="[null]" active="[true]" />
-
- <!-- on other resources -->
- <group_roles id="1" group_id="100" resource_id="1" role="admin"/>
- <group_roles id="2" group_id="101" resource_id="1" role="user"/>
- <user_roles id="1" user_id="200" resource_id="1" role="admin"/>
-</dataset> \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles_unknown_group-result.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles_unknown_group-result.xml
deleted file mode 100644
index ef56a12934c..00000000000
--- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles_unknown_group-result.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<dataset>
- <groups id="100" name="sonar-administrators"/>
- <groups id="101" name="sonar-users"/>
- <users id="200" login="marius" name="Marius" email="[null]" active="[true]"/>
-
- <!-- on other resources -->
- <group_roles id="1" group_id="100" resource_id="1" role="admin"/>
- <group_roles id="2" group_id="101" resource_id="1" role="user"/>
- <user_roles id="1" user_id="200" resource_id="1" role="admin"/>
-
- <!--
- new rows : sonar-administrators (admin)
- -->
- <group_roles id="3" group_id="100" resource_id="123" role="admin"/>
-
-</dataset> \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles_unknown_group.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles_unknown_group.xml
deleted file mode 100644
index 21a4dda2ccf..00000000000
--- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles_unknown_group.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<dataset>
- <groups id="100" name="sonar-administrators" />
- <groups id="101" name="sonar-users" />
- <users id="200" login="marius" name="Marius" email="[null]" active="[true]" />
-
- <!-- on other resources -->
- <group_roles id="1" group_id="100" resource_id="1" role="admin"/>
- <group_roles id="2" group_id="101" resource_id="1" role="user"/>
- <user_roles id="1" user_id="200" resource_id="1" role="admin"/>
-</dataset> \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles_users-result.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles_users-result.xml
deleted file mode 100644
index caff65f9e21..00000000000
--- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles_users-result.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<dataset>
- <groups id="100" name="sonar-administrators"/>
- <groups id="101" name="sonar-users"/>
- <users id="200" login="marius" name="Marius" email="[null]" active="[true]"/>
- <users id="201" login="disabled" name="Disabled" email="[null]" active="[false]"/>
-
- <!-- on other resources -->
- <group_roles id="1" group_id="100" resource_id="1" role="admin"/>
- <group_roles id="2" group_id="101" resource_id="1" role="user"/>
- <user_roles id="1" user_id="200" resource_id="1" role="admin"/>
-
- <!--
- new row : marius (admin)
- -->
- <user_roles id="2" user_id="200" resource_id="123" role="admin"/>
-</dataset> \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles_users.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles_users.xml
deleted file mode 100644
index 7c5f6c5d347..00000000000
--- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantDefaultRoles_users.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<dataset>
- <groups id="100" name="sonar-administrators" />
- <groups id="101" name="sonar-users" />
- <users id="200" login="marius" name="Marius" email="[null]" active="[true]" />
- <users id="201" login="disabled" name="Disabled" email="[null]" active="[false]" />
-
- <!-- on other resources -->
- <group_roles id="1" group_id="100" resource_id="1" role="admin"/>
- <group_roles id="2" group_id="101" resource_id="1" role="user"/>
- <user_roles id="1" user_id="200" resource_id="1" role="admin"/>
-</dataset> \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole-result.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole-result.xml
deleted file mode 100644
index 9d3ae472eb6..00000000000
--- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole-result.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<dataset>
- <groups id="100" name="sonar-administrators"/>
- <groups id="101" name="sonar-users"/>
-
- <group_roles group_id="100" resource_id="123" role="admin"/>
-</dataset> \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole.xml
deleted file mode 100644
index 6a4d9c92410..00000000000
--- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<dataset>
- <groups id="100" name="sonar-administrators" />
- <groups id="101" name="sonar-users" />
-</dataset> \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_anyone-result.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_anyone-result.xml
deleted file mode 100644
index 4b48bf9e59a..00000000000
--- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_anyone-result.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<dataset>
- <groups id="100" name="sonar-administrators" />
- <groups id="101" name="sonar-users" />
-
- <group_roles id="1" group_id="[null]" resource_id="123" role="admin"/>
-</dataset> \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_anyone.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_anyone.xml
deleted file mode 100644
index 6a4d9c92410..00000000000
--- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_anyone.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<dataset>
- <groups id="100" name="sonar-administrators" />
- <groups id="101" name="sonar-users" />
-</dataset> \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_ignore_if_group_not_found-result.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_ignore_if_group_not_found-result.xml
deleted file mode 100644
index 78695dd52b2..00000000000
--- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_ignore_if_group_not_found-result.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<dataset>
- <groups id="100" name="sonar-administrators" />
- <groups id="101" name="sonar-users" />
-
- <!-- already existed -->
- <group_roles id="1" group_id="[null]" resource_id="123" role="admin"/>
-</dataset> \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_ignore_if_group_not_found.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_ignore_if_group_not_found.xml
deleted file mode 100644
index 78695dd52b2..00000000000
--- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_ignore_if_group_not_found.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<dataset>
- <groups id="100" name="sonar-administrators" />
- <groups id="101" name="sonar-users" />
-
- <!-- already existed -->
- <group_roles id="1" group_id="[null]" resource_id="123" role="admin"/>
-</dataset> \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_ignore_if_not_persisted-result.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_ignore_if_not_persisted-result.xml
deleted file mode 100644
index 78695dd52b2..00000000000
--- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_ignore_if_not_persisted-result.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<dataset>
- <groups id="100" name="sonar-administrators" />
- <groups id="101" name="sonar-users" />
-
- <!-- already existed -->
- <group_roles id="1" group_id="[null]" resource_id="123" role="admin"/>
-</dataset> \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_ignore_if_not_persisted.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_ignore_if_not_persisted.xml
deleted file mode 100644
index 78695dd52b2..00000000000
--- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantGroupRole_ignore_if_not_persisted.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<dataset>
- <groups id="100" name="sonar-administrators" />
- <groups id="101" name="sonar-users" />
-
- <!-- already existed -->
- <group_roles id="1" group_id="[null]" resource_id="123" role="admin"/>
-</dataset> \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantUserRole-result.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantUserRole-result.xml
deleted file mode 100644
index 7f154cd1915..00000000000
--- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantUserRole-result.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<dataset>
- <users id="200" login="marius" name="Marius" email="[null]" active="[true]"/>
-
- <user_roles user_id="200" resource_id="123" role="admin"/>
-
-</dataset> \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantUserRole.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantUserRole.xml
deleted file mode 100644
index d513321d554..00000000000
--- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/grantUserRole.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-<dataset>
- <users id="200" login="marius" name="Marius" email="[null]" active="[true]" />
-</dataset> \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/hasRoles.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/hasRoles.xml
deleted file mode 100644
index 3d5f9a5ecf2..00000000000
--- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/DefaultResourcePermissionsTest/hasRoles.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<dataset>
- <groups id="100" name="sonar-administrators"/>
- <groups id="101" name="sonar-users"/>
- <users id="200" login="marius" name="Marius" email="[null]" active="[true]"/>
-
- <!-- only_users -->
- <user_roles id="1" user_id="200" resource_id="1" role="admin"/>
-
- <!-- only_groups -->
- <group_roles id="1" group_id="100" resource_id="2" role="admin"/>
-
- <!-- groups_and_users -->
- <group_roles id="2" group_id="101" resource_id="3" role="user"/>
- <user_roles id="2" user_id="200" resource_id="3" role="admin"/>
-
-</dataset> \ No newline at end of file