diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-11-03 15:47:21 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-11-03 18:19:18 +0100 |
commit | 917611d296a3928f41bb6ace63b4939eb55ff26b (patch) | |
tree | 77ab5d1a5e7f04e21c31675827fb5f3ab8000535 /server | |
parent | 806a8066d12e5589b1833d368f989bf64456b21c (diff) | |
download | sonarqube-917611d296a3928f41bb6ace63b4939eb55ff26b.tar.gz sonarqube-917611d296a3928f41bb6ace63b4939eb55ff26b.zip |
SONAR-6912 do not remove admin permission on user if no more admins
Diffstat (limited to 'server')
-rw-r--r-- | server/sonar-server/src/main/java/org/sonar/server/permission/UserPermissionChanger.java | 2 |
1 files changed, 1 insertions, 1 deletions
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)); |