From: Simon Brandhof Date: Sun, 29 Jan 2017 15:28:27 +0000 (+0100) Subject: SONAR-8716 Remove unused method UserSession#hasGlobalPermission(String) X-Git-Tag: 6.3-RC1~268 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e2fbdcb385cee0bc49260e695b57f03e124f7bc9;p=sonarqube.git SONAR-8716 Remove unused method UserSession#hasGlobalPermission(String) --- diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/user/CeUserSession.java b/server/sonar-ce/src/main/java/org/sonar/ce/user/CeUserSession.java index c67c2880f30..39f6f821fa4 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/user/CeUserSession.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/user/CeUserSession.java @@ -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 globalPermissions() { return notImplemented(); diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/AbstractUserSession.java b/server/sonar-server/src/main/java/org/sonar/server/user/AbstractUserSession.java index 90507535851..a61b44710e1 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/AbstractUserSession.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/AbstractUserSession.java @@ -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)) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/ThreadLocalUserSession.java b/server/sonar-server/src/main/java/org/sonar/server/user/ThreadLocalUserSession.java index 2a03c9af16d..db21fb6b49b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/ThreadLocalUserSession.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/ThreadLocalUserSession.java @@ -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 globalPermissions() { return get().globalPermissions(); diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/UserSession.java b/server/sonar-server/src/main/java/org/sonar/server/user/UserSession.java index 2eb5b598177..1e3a0515e99 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/UserSession.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/UserSession.java @@ -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 globalPermissions(); /** diff --git a/server/sonar-server/src/test/java/org/sonar/server/tester/UserSessionRule.java b/server/sonar-server/src/test/java/org/sonar/server/tester/UserSessionRule.java index fb6f4995c1f..1798c27d534 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/tester/UserSessionRule.java +++ b/server/sonar-server/src/test/java/org/sonar/server/tester/UserSessionRule.java @@ -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); 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 b2f96903a15..a357d6925a5 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 @@ -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);