From 8c933019b0404716488e8c919c2b7571a425e9ee Mon Sep 17 00:00:00 2001 From: Teryk Bellahsene Date: Tue, 15 Nov 2016 15:20:54 +0100 Subject: [PATCH] Project admin permission is not considered as a System Admin --- .../test/java/org/sonar/server/user/ServerUserSessionTest.java | 2 ++ .../resources/org/sonar/db/permission/AuthorizationMapper.xml | 1 + .../test/java/org/sonar/db/permission/AuthorizationDaoTest.java | 2 ++ 3 files changed, 5 insertions(+) diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ServerUserSessionTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ServerUserSessionTest.java index 91f5b85adb8..a26e65bb4ea 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ServerUserSessionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ServerUserSessionTest.java @@ -336,7 +336,9 @@ public class ServerUserSessionTest { @Test public void hasOrganizationPermission_for_logged_in_user() { OrganizationDto org = db.organizations().insert(); + ComponentDto project = db.components().insertProject(); db.users().insertPermissionOnUser(org, userDto, GlobalPermissions.PROVISIONING); + db.users().insertProjectPermissionOnUser(org, userDto, UserRole.ADMIN, project); UserSession session = newUserSession(userDto); assertThat(session.hasOrganizationPermission(org.getUuid(), GlobalPermissions.PROVISIONING)).isTrue(); diff --git a/sonar-db/src/main/resources/org/sonar/db/permission/AuthorizationMapper.xml b/sonar-db/src/main/resources/org/sonar/db/permission/AuthorizationMapper.xml index 6c132aeb434..d5e441bcbce 100644 --- a/sonar-db/src/main/resources/org/sonar/db/permission/AuthorizationMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/permission/AuthorizationMapper.xml @@ -28,6 +28,7 @@ where ur.organization_uuid=#{organizationUuid,jdbcType=VARCHAR} and ur.user_id=#{userId,jdbcType=BIGINT} + and ur.resource_id is null