]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8263 verify authorization on organization
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 14 Oct 2016 08:02:26 +0000 (10:02 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Sun, 16 Oct 2016 17:10:46 +0000 (19:10 +0200)
server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveUserActionTest.java

index ff310370455d66c7fa1e29ea51144b4b7b090fc9..cf4449dac817150217de4813837ea49579223674 100644 (file)
@@ -23,6 +23,7 @@ import org.junit.Before;
 import org.junit.Test;
 import org.sonar.api.web.UserRole;
 import org.sonar.db.component.ComponentDto;
+import org.sonar.db.organization.OrganizationDto;
 import org.sonar.db.user.UserDto;
 import org.sonar.server.exceptions.BadRequestException;
 import org.sonar.server.exceptions.ForbiddenException;
@@ -276,6 +277,10 @@ public class RemoveUserActionTest extends BasePermissionWsTest<RemoveUserAction>
   }
 
   private void loginAsAdmin() {
-    userSession.login("admin").setGlobalPermissions(SYSTEM_ADMIN);
+    loginAsOrganizationAdmin(db.getDefaultOrganization());
+  }
+
+  private void loginAsOrganizationAdmin(OrganizationDto org) {
+    userSession.login().addOrganizationPermission(org.getUuid(), SYSTEM_ADMIN);
   }
 }