]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8134 fix isolation of organizations when dropping global permissions on user
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 21 Oct 2016 13:25:28 +0000 (15:25 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 21 Oct 2016 14:21:21 +0000 (16:21 +0200)
server/sonar-server/src/test/java/org/sonar/server/permission/GroupPermissionChangerTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveUserActionTest.java

index 423151a26d8d2953f2b4e8ebd75bb2e5d8abd29c..006df94c22305f9c2ce346caa3d7d88492334153 100644 (file)
@@ -177,7 +177,7 @@ public class GroupPermissionChangerTest {
     GroupIdOrAnyone groupId = new GroupIdOrAnyone(group);
     db.users().insertPermissionOnGroup(group, GlobalPermissions.SYSTEM_ADMIN);
     UserDto admin = db.users().insertUser();
-    db.users().insertPermissionOnUser(admin, GlobalPermissions.SYSTEM_ADMIN);
+    db.users().insertPermissionOnUser(org, admin, GlobalPermissions.SYSTEM_ADMIN);
 
     apply(new GroupPermissionChange(PermissionChange.Operation.REMOVE, GlobalPermissions.SYSTEM_ADMIN, null, groupId));
 
index d3a4729f7a3f2fc84854514f1f92eecdf0d4139b..1fa8a6c39eb3d4c01881c74700972e9edd9e90b0 100644 (file)
@@ -260,6 +260,10 @@ public class RemoveUserActionTest extends BasePermissionWsTest<RemoveUserAction>
     OrganizationDto otherOrganization = db.organizations().insert();
     db.users().insertPermissionOnUser(otherOrganization, rootUser, SYSTEM_ADMIN);
     db.users().insertPermissionOnUser(otherOrganization, notRootUser, SYSTEM_ADMIN);
+    // another admin is required so that admin permission can be dropped
+    UserDto anotherAdmin = db.users().insertUser();
+    db.users().insertPermissionOnUser(otherOrganization, anotherAdmin, SYSTEM_ADMIN);
+
     loginAsAdmin(otherOrganization);
 
     executeRequest(rootUser, otherOrganization, SYSTEM_ADMIN);