From 917611d296a3928f41bb6ace63b4939eb55ff26b Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Thu, 3 Nov 2016 15:47:21 +0100 Subject: SONAR-6912 do not remove admin permission on user if no more admins --- .../main/java/org/sonar/server/permission/UserPermissionChanger.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server') diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/UserPermissionChanger.java b/server/sonar-server/src/main/java/org/sonar/server/permission/UserPermissionChanger.java index 61b4e977762..060592528a4 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/UserPermissionChanger.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/UserPermissionChanger.java @@ -92,7 +92,7 @@ public class UserPermissionChanger { private void checkOtherAdminsExist(DbSession dbSession, UserPermissionChange change) { if (SYSTEM_ADMIN.equals(change.getPermission()) && !change.getProjectId().isPresent()) { - int remaining = dbClient.authorizationDao().countUsersWithGlobalPermissionExcludingUser(dbSession, + int remaining = dbClient.authorizationDao().countUsersWithGlobalPermissionExcludingUserPermission(dbSession, change.getOrganizationUuid(), change.getPermission(), change.getUserId().getId()); if (remaining == 0) { throw new BadRequestException(String.format("Last user with permission '%s'. Permission cannot be removed.", SYSTEM_ADMIN)); -- cgit v1.2.3