From c64d3b1f42125cde53b421df490199fe762dd393 Mon Sep 17 00:00:00 2001 From: Gravit Date: Wed, 26 Dec 2018 19:51:40 +0700 Subject: [PATCH] =?UTF-8?q?PermissionsManager=20=D1=83=D0=B4=D0=B0=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=B7=D0=B0=20=D0=BD=D0=B5=D0=BD=D0=B0=D0=B4?= =?UTF-8?q?=D0=BE=D0=B1=D0=BD=D0=BE=D1=81=D1=82=D1=8C=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JsonFilePermissionsHandler.java | 1 - .../auth/provider/AuthProviderResult.java | 4 ++-- .../manangers/PermissionsManager.java | 24 ------------------- 3 files changed, 2 insertions(+), 27 deletions(-) delete mode 100644 LaunchServer/src/main/java/ru/gravit/launchserver/manangers/PermissionsManager.java diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/permissions/JsonFilePermissionsHandler.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/permissions/JsonFilePermissionsHandler.java index fb15aa7c..a2b837c5 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/permissions/JsonFilePermissionsHandler.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/permissions/JsonFilePermissionsHandler.java @@ -4,7 +4,6 @@ import ru.gravit.launcher.Launcher; import ru.gravit.launchserver.Reloadable; import ru.gravit.launchserver.auth.ClientPermissions; -import ru.gravit.launchserver.manangers.PermissionsManager; import ru.gravit.utils.helper.IOHelper; import ru.gravit.utils.helper.LogHelper; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/AuthProviderResult.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/AuthProviderResult.java index d34f90c1..4432bb8d 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/AuthProviderResult.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/AuthProviderResult.java @@ -1,7 +1,7 @@ package ru.gravit.launchserver.auth.provider; +import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.auth.ClientPermissions; -import ru.gravit.launchserver.manangers.PermissionsManager; public class AuthProviderResult { @@ -12,7 +12,7 @@ public class AuthProviderResult { public AuthProviderResult(String username, String accessToken) { this.username = username; this.accessToken = accessToken; - permissions = PermissionsManager.getPermissions(username); + permissions = LaunchServer.server.config.permissionsHandler.getPermissions(username); } public AuthProviderResult(String username, String accessToken, ClientPermissions permissions) { diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/PermissionsManager.java b/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/PermissionsManager.java deleted file mode 100644 index ea5c75b7..00000000 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/PermissionsManager.java +++ /dev/null @@ -1,24 +0,0 @@ -package ru.gravit.launchserver.manangers; - -import ru.gravit.launchserver.auth.ClientPermissions; - -public class PermissionsManager { - private static PermissionsFunction function = PermissionsManager::returnDefault; - public static void registerPermissionsFunction(PermissionsFunction function) - { - PermissionsManager.function = function; - } - public static ClientPermissions getPermissions(String username) - { - return function.getPermission(username); - } - @FunctionalInterface - public interface PermissionsFunction - { - ClientPermissions getPermission(String username); - } - public static ClientPermissions returnDefault(String username) - { - return ClientPermissions.DEFAULT; - } -}