]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8716 Remove unused method UserSession#hasGlobalPermission(String)
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Sun, 29 Jan 2017 15:28:27 +0000 (16:28 +0100)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 1 Feb 2017 16:11:52 +0000 (17:11 +0100)
server/sonar-ce/src/main/java/org/sonar/ce/user/CeUserSession.java
server/sonar-server/src/main/java/org/sonar/server/user/AbstractUserSession.java
server/sonar-server/src/main/java/org/sonar/server/user/ThreadLocalUserSession.java
server/sonar-server/src/main/java/org/sonar/server/user/UserSession.java
server/sonar-server/src/test/java/org/sonar/server/tester/UserSessionRule.java
server/sonar-server/src/test/java/org/sonar/server/user/ServerUserSessionTest.java

index c67c2880f30931f98484404f99d3d01e93fd1d34..39f6f821fa4e97f47580aab31631a9ba7b3dfe4a 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonar.ce.user;
 
-import java.util.Collection;
 import java.util.List;
 import java.util.Set;
 import org.sonar.db.user.GroupDto;
@@ -100,11 +99,6 @@ public class CeUserSession implements UserSession {
     return notImplemented();
   }
 
-  @Override
-  public boolean hasGlobalPermission(String globalPermission) {
-    return notImplementedBooleanMethod();
-  }
-
   @Override
   public List<String> globalPermissions() {
     return notImplemented();
index 905075358511dcc8b5ecb088d97b45326efeb1f1..a61b44710e1bcad94e8ef7275c941d753b986bb0 100644 (file)
@@ -71,11 +71,6 @@ public abstract class AbstractUserSession implements UserSession {
     return isRoot() || globalPermissions().contains(globalPermission);
   }
 
-  @Override
-  public boolean hasGlobalPermission(String globalPermission) {
-    return isRoot() || hasPermission(globalPermission);
-  }
-
   @Override
   public UserSession checkComponentPermission(String projectPermission, String componentKey) {
     if (!hasComponentPermission(projectPermission, componentKey)) {
index 2a03c9af16d387f369820b9622339dd674b9064e..db21fb6b49b099d09754cbfb9df0e25a00336b88 100644 (file)
@@ -113,11 +113,6 @@ public class ThreadLocalUserSession implements UserSession {
     return get().hasPermission(globalPermission);
   }
 
-  @Override
-  public boolean hasGlobalPermission(String globalPermission) {
-    return get().hasGlobalPermission(globalPermission);
-  }
-
   @Override
   public List<String> globalPermissions() {
     return get().globalPermissions();
index 2eb5b59817756ef08c22d9e68a47a3a4e8c936a8..1e3a0515e991327e7ca4571e83dbf0cf8e0bf20d 100644 (file)
@@ -105,12 +105,6 @@ public interface UserSession {
    */
   UserSession checkOrganizationPermission(String organizationUuid, String permission);
 
-  /**
-   * @deprecated Only used by Views and the Developer Cockpit plugins.
-   */
-  @Deprecated
-  boolean hasGlobalPermission(String globalPermission);
-
   List<String> globalPermissions();
 
   /**
index fb6f4995c1f538f037a66f047d2f7bc112f8dee1..1798c27d534e86e0246f441d2162a10dac3769d3 100644 (file)
@@ -325,11 +325,6 @@ public class UserSessionRule implements TestRule, UserSession {
     return currentUserSession.hasPermission(globalPermission);
   }
 
-  @Override
-  public boolean hasGlobalPermission(String globalPermission) {
-    return currentUserSession.hasGlobalPermission(globalPermission);
-  }
-
   @Override
   public boolean hasOrganizationPermission(String organizationUuid, String permission) {
     return currentUserSession.hasOrganizationPermission(organizationUuid, permission);
index b2f96903a15666c6171e791e0302a25900f9f4b5..a357d6925a528307c60ce6306dfd01618272d8fe 100644 (file)
@@ -308,16 +308,6 @@ public class ServerUserSessionTest {
     session.checkComponentUuidPermission(UserRole.USER, "another-uuid");
   }
 
-  @Test
-  public void deprecated_has_global_permission() throws Exception {
-    addGlobalPermissions("profileadmin", "admin");
-    UserSession session = newUserSession(userDto);
-
-    assertThat(session.hasGlobalPermission(QUALITY_PROFILE_ADMIN)).isTrue();
-    assertThat(session.hasGlobalPermission(SYSTEM_ADMIN)).isTrue();
-    assertThat(session.hasGlobalPermission(QUALITY_GATE_ADMIN)).isFalse();
-  }
-
   @Test
   public void fail_if_user_dto_is_null() throws Exception {
     expectedException.expect(NullPointerException.class);