Несколько стандартных PermissionsHandler

This commit is contained in:
Gravit 2018-12-26 18:09:35 +07:00
parent a606cb23e1
commit 291f6e4405
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
3 changed files with 28 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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;
}
}