aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core/src/main
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2013-06-29 19:07:40 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2013-06-29 19:07:40 +0200
commitb319c87ecf00b6c95b5dcb7924bdc8689b5153a0 (patch)
treed47b7d4e19848a3c22778b7a6b0466bdb9e9a1f7 /sonar-core/src/main
parent70b6abe27893c2bef042cce311e0e4d90654e23f (diff)
downloadsonarqube-b319c87ecf00b6c95b5dcb7924bdc8689b5153a0.tar.gz
sonarqube-b319c87ecf00b6c95b5dcb7924bdc8689b5153a0.zip
SONAR-4412 revert check of last remaining admin user
Diffstat (limited to 'sonar-core/src/main')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/user/RoleDao.java10
-rw-r--r--sonar-core/src/main/java/org/sonar/core/user/RoleMapper.java2
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/user/RoleMapper.xml14
3 files changed, 1 insertions, 25 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/user/RoleDao.java b/sonar-core/src/main/java/org/sonar/core/user/RoleDao.java
index 74884a41794..0b275b9662c 100644
--- a/sonar-core/src/main/java/org/sonar/core/user/RoleDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/user/RoleDao.java
@@ -145,14 +145,4 @@ public class RoleDao implements TaskExtension, ServerExtension {
MyBatis.closeQuietly(session);
}
}
-
- public int countSystemAdministrators(@Nullable String groupName) {
- SqlSession session = mybatis.openSession();
- try {
- RoleMapper mapper = session.getMapper(RoleMapper.class);
- return mapper.countSystemAdministrators(groupName);
- } finally {
- MyBatis.closeQuietly(session);
- }
- }
}
diff --git a/sonar-core/src/main/java/org/sonar/core/user/RoleMapper.java b/sonar-core/src/main/java/org/sonar/core/user/RoleMapper.java
index da7b6c422ef..0fcaac7973b 100644
--- a/sonar-core/src/main/java/org/sonar/core/user/RoleMapper.java
+++ b/sonar-core/src/main/java/org/sonar/core/user/RoleMapper.java
@@ -49,5 +49,5 @@ public interface RoleMapper {
int countUserRoles(Long resourceId);
- int countSystemAdministrators(@Nullable @Param("groupName") String groupName);
+ List<Long> countSystemAdministrators(@Nullable @Param("groupName") String groupName);
}
diff --git a/sonar-core/src/main/resources/org/sonar/core/user/RoleMapper.xml b/sonar-core/src/main/resources/org/sonar/core/user/RoleMapper.xml
index 1a267371a9b..3dba348d55a 100644
--- a/sonar-core/src/main/resources/org/sonar/core/user/RoleMapper.xml
+++ b/sonar-core/src/main/resources/org/sonar/core/user/RoleMapper.xml
@@ -88,18 +88,4 @@
SELECT count(id)
FROM group_roles WHERE resource_id=#{id}
</select>
-
- <select id="countSystemAdministrators" parameterType="String" resultType="int">
- SELECT COUNT(DISTINCT u.id)
- FROM users AS u
- LEFT JOIN user_roles AS ur ON ur.user_id = u.id
- INNER JOIN groups_users AS gu ON gu.user_id = u.id
- INNER JOIN group_roles AS gr ON gr.group_id = gu.group_id
- INNER JOIN groups AS g ON g.id = gu.group_id
- WHERE (ur.role = 'admin' AND ur.resource_id IS NULL) OR (gr.role = 'admin' AND gr.resource_id IS NULL)
- AND u.active = ${_true}
- <if test="groupName != null">
- AND g.name != #{groupName}
- </if>
- </select>
</mapper>