[FIX] Фикс пермишшенов в MySQLAuthProvider RequestAuthProvider

This commit is contained in:
Gravit 2019-01-21 20:30:23 +07:00
parent 4adb51f6cf
commit c865a8fec8
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
3 changed files with 5 additions and 3 deletions

View file

@ -1,6 +1,7 @@
package ru.gravit.launchserver.auth.provider;
import ru.gravit.launcher.ClientPermissions;
import ru.gravit.launchserver.LaunchServer;
import ru.gravit.launchserver.auth.AuthException;
import ru.gravit.launchserver.auth.MySQLSourceConfig;
import ru.gravit.utils.helper.CommonHelper;
@ -35,7 +36,7 @@ public AuthProviderResult auth(String login, String password, String ip) throws
// Execute SQL query
s.setQueryTimeout(MySQLSourceConfig.TIMEOUT);
try (ResultSet set = s.executeQuery()) {
return set.next() ? new AuthProviderResult(set.getString(1), SecurityHelper.randomStringToken(), usePermission ? new ClientPermissions(set.getLong(2)) : new ClientPermissions()) : authError(message);
return set.next() ? new AuthProviderResult(set.getString(1), SecurityHelper.randomStringToken(), usePermission ? new ClientPermissions(set.getLong(2)) : LaunchServer.server.config.permissionsHandler.getPermissions(set.getString(1))) : authError(message);
}
}

View file

@ -1,6 +1,7 @@
package ru.gravit.launchserver.auth.provider;
import ru.gravit.launcher.ClientPermissions;
import ru.gravit.launchserver.LaunchServer;
import ru.gravit.utils.helper.CommonHelper;
import ru.gravit.utils.helper.IOHelper;
import ru.gravit.utils.helper.LogHelper;
@ -31,7 +32,7 @@ public AuthProviderResult auth(String login, String password, String ip) throws
// Match username
Matcher matcher = pattern.matcher(currentResponse);
return matcher.matches() && matcher.groupCount() >= 1 ?
new AuthProviderResult(matcher.group("username"), SecurityHelper.randomStringToken(), usePermission ? new ClientPermissions(Long.getLong(matcher.group("permission"))) : new ClientPermissions()) :
new AuthProviderResult(matcher.group("username"), SecurityHelper.randomStringToken(), usePermission ? new ClientPermissions(Long.getLong(matcher.group("permission"))) : LaunchServer.server.config.permissionsHandler.getPermissions(login)) :
authError(currentResponse);
}

@ -1 +1 @@
Subproject commit 53106ee20700cb73ad65fd7dddf69b0d0b766f4c
Subproject commit 38e11640ce4a4ed3e9745718db02a888770a22bb