]> source.dussan.org Git - sonarqube.git/commitdiff
Project admin permission is not considered as a System Admin 1388/head
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Tue, 15 Nov 2016 14:20:54 +0000 (15:20 +0100)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Tue, 15 Nov 2016 16:09:09 +0000 (17:09 +0100)
server/sonar-server/src/test/java/org/sonar/server/user/ServerUserSessionTest.java
sonar-db/src/main/resources/org/sonar/db/permission/AuthorizationMapper.xml
sonar-db/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java

index 91f5b85adb8a11e4aed2c0b66231d3f9a526c6b6..a26e65bb4eaccfa1ec219b748188e73867b31543 100644 (file)
@@ -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();
index 6c132aeb4346b1cefb9393c95261689fcfe93599..d5e441bcbce64e8f135d528bf6c2345ca29a68c1 100644 (file)
@@ -28,6 +28,7 @@
     where
     ur.organization_uuid=#{organizationUuid,jdbcType=VARCHAR} and
     ur.user_id=#{userId,jdbcType=BIGINT}
+    and ur.resource_id is null
   </select>
 
   <select id="selectOrganizationPermissionsOfAnonymous" parameterType="map" resultType="string">
index 9f213a99fbe49d668b29f0d25cf7c6baddc80de0..42adf47bd9ad33155a7a918d6a7755cfd7fcefcd 100644 (file)
@@ -72,8 +72,10 @@ public class AuthorizationDaoTest {
    */
   @Test
   public void selectOrganizationPermissions_for_logged_in_user() {
+    ComponentDto project = db.components().insertProject();
     db.users().insertMember(group1, user);
     db.users().insertPermissionOnUser(org, user, "perm1");
+    db.users().insertProjectPermissionOnUser(org, user, "perm42", project);
     db.users().insertPermissionOnGroup(group1, "perm2");
     db.users().insertPermissionOnAnyone(org, "perm3");