[FIX] Фикс привилений при авторизации

This commit is contained in:
Gravit 2019-01-28 21:16:11 +07:00
parent 43de166d22
commit a6686029a5
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -39,7 +39,7 @@ public AuthResponse(String login, String password, int authid, OshiHWID hwid) {
public OshiHWID hwid; public OshiHWID hwid;
public enum ConnectTypes public enum ConnectTypes
{ {
SERVER,CLIENT SERVER,CLIENT,BOT
} }
@Override @Override
@ -56,10 +56,19 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client
AuthProvider.authError(LaunchServer.server.config.authRejectString); AuthProvider.authError(LaunchServer.server.config.authRejectString);
return; return;
} }
if (authType == ConnectTypes.SERVER &&!clientData.checkSign) { if (authType != ConnectTypes.CLIENT &&!clientData.checkSign) {
AuthProvider.authError("Don't skip Launcher Update"); AuthProvider.authError("Don't skip Launcher Update");
return; return;
} }
clientData.permissions = LaunchServer.server.config.permissionsHandler.getPermissions(login);
if(authType == ConnectTypes.BOT && !clientData.permissions.canBot)
{
AuthProvider.authError("authType: BOT not allowed for this account");
}
if(authType == ConnectTypes.SERVER && !clientData.permissions.canServer)
{
AuthProvider.authError("authType: SERVER not allowed for this account");
}
ru.gravit.launchserver.response.auth.AuthResponse.AuthContext context = new ru.gravit.launchserver.response.auth.AuthResponse.AuthContext(0, login, password.length(), client, null, false); ru.gravit.launchserver.response.auth.AuthResponse.AuthContext context = new ru.gravit.launchserver.response.auth.AuthResponse.AuthContext(0, login, password.length(), client, null, false);
AuthProvider provider = LaunchServer.server.config.authProvider[authid]; AuthProvider provider = LaunchServer.server.config.authProvider[authid];
LaunchServer.server.authHookManager.preHook(context, clientData); LaunchServer.server.authHookManager.preHook(context, clientData);