From 291f6e4405da6cc7b2180a24f283cc152aabfb17 Mon Sep 17 00:00:00 2001 From: Gravit Date: Wed, 26 Dec 2018 18:09:35 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B5=D1=81=D0=BA=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D0=BA=D0=BE=20=D1=81=D1=82=D0=B0=D0=BD=D0=B4=D0=B0=D1=80=D1=82?= =?UTF-8?q?=D0=BD=D1=8B=D1=85=20PermissionsHandler?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../permissions/ConfigPermissionsHandler.java | 16 ++++++++++++++++ .../permissions/DefaultPermissionsHandler.java | 10 ++++++++++ .../auth/permissions/PermissionsHandler.java | 2 ++ 3 files changed, 28 insertions(+) create mode 100644 LaunchServer/src/main/java/ru/gravit/launchserver/auth/permissions/ConfigPermissionsHandler.java create mode 100644 LaunchServer/src/main/java/ru/gravit/launchserver/auth/permissions/DefaultPermissionsHandler.java diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/permissions/ConfigPermissionsHandler.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/permissions/ConfigPermissionsHandler.java new file mode 100644 index 00000000..0e5ba896 --- /dev/null +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/permissions/ConfigPermissionsHandler.java @@ -0,0 +1,16 @@ +package ru.gravit.launchserver.auth.permissions; + +import ru.gravit.launchserver.auth.ClientPermissions; +import ru.gravit.launchserver.socket.Client; + +public class ConfigPermissionsHandler extends PermissionsHandler { + public boolean isAdmin = false; + public boolean isServer = false; + @Override + public ClientPermissions getPermissions(String username) { + ClientPermissions permissions = new ClientPermissions(); + permissions.canServer = isServer; + permissions.canAdmin = isAdmin; + return permissions; + } +} diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/permissions/DefaultPermissionsHandler.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/permissions/DefaultPermissionsHandler.java new file mode 100644 index 00000000..39c32310 --- /dev/null +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/permissions/DefaultPermissionsHandler.java @@ -0,0 +1,10 @@ +package ru.gravit.launchserver.auth.permissions; + +import ru.gravit.launchserver.auth.ClientPermissions; + +public class DefaultPermissionsHandler extends PermissionsHandler { + @Override + public ClientPermissions getPermissions(String username) { + return ClientPermissions.DEFAULT; + } +} diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/permissions/PermissionsHandler.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/permissions/PermissionsHandler.java index 5079eb07..6da71307 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/permissions/PermissionsHandler.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/permissions/PermissionsHandler.java @@ -30,6 +30,8 @@ public static String getHandlerName(Class clazz) public static void registerHandlers() { if (!registredHandl) { registerHandler("json", JsonFilePermissionsHandler.class); + registerHandler("config", ConfigPermissionsHandler.class); + registerHandler("default", DefaultPermissionsHandler.class); registredHandl = true; } }