mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-22 15:16:15 -08:00
Added user privilege level (#2228)
* Update log path example when running under windows Added example of log path syntax when running servatrice under windows. * Missed example bra cket * Added user privilege level Added a enum column in the users table named "privilevel" with the current values of "none", "vip", and "donator". Also allowed anyone with a higher privilege level than "none" to log in even if the server is set to limit the user total and the user limit is reached. This change add's the new user information into the users container that gets populated and passed between client and server. * Added user privilege level Added a enum column in the users table named "privilevel" with the current values of "none", "vip", and "donator". Also allowed anyone with a higher privilege level than "none" to log in even if the server is set to limit the user total and the user limit is reached. This change add's the new user information into the users container that gets populated and passed between client and server. * don't use corrected name when downloading card (#2164) * Fix dynamic user limit settings PR #2220 removed the ability to be able to change the max user limit count while the server is running requiring a restart to make the settings change. This PR reverts the behavior back to how it operated prior to the PR. * Call class functions for consistency Updated code to call functions for consistency. * don't use corrected name when downloading card (#2164) * Added user privilege level Added a enum column in the users table named "privilevel" with the current values of "none", "vip", and "donator". Also allowed anyone with a higher privilege level than "none" to log in even if the server is set to limit the user total and the user limit is reached. This change add's the new user information into the users container that gets populated and passed between client and server. * Corrected Typo Corrected typo in DB Migration Script * Git fuckup? * Added word column Added the word column to migration script for backwards compatibility
This commit is contained in:
@@ -383,14 +383,7 @@ Response::ResponseCode Server_ProtocolHandler::cmdPing(const Command_Ping & /*cm
|
||||
|
||||
Response::ResponseCode Server_ProtocolHandler::cmdLogin(const Command_Login &cmd, ResponseContainer &rc)
|
||||
{
|
||||
// limit the number of users that can connect to the server based on configuration settings
|
||||
if (server->getMaxUserLimitEnabled()) {
|
||||
if (server->getUsersCount() >= server->getMaxUserLimit()) {
|
||||
qDebug() << "Max Users Total Limit Reached, please increase the max_users_total setting.";
|
||||
return Response::RespServerFull;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QString userName = QString::fromStdString(cmd.user_name()).simplified();
|
||||
QString clientId = QString::fromStdString(cmd.clientid()).simplified();
|
||||
QString clientVersion = QString::fromStdString(cmd.clientver()).simplified();
|
||||
@@ -447,6 +440,16 @@ Response::ResponseCode Server_ProtocolHandler::cmdLogin(const Command_Login &cmd
|
||||
default: authState = res;
|
||||
}
|
||||
|
||||
// limit the number of non-privileged users that can connect to the server based on configuration settings
|
||||
if (QString::fromStdString(userInfo->privlevel()).toLower() == "none") {
|
||||
if (server->getMaxUserLimitEnabled()) {
|
||||
if (server->getUsersCount() > server->getMaxUserLimit()) {
|
||||
qDebug() << "Max Users Total Limit Reached, please increase the max_users_total setting.";
|
||||
return Response::RespServerFull;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
userName = QString::fromStdString(userInfo->name());
|
||||
Event_ServerMessage event;
|
||||
event.set_message(server->getLoginMessage().toStdString());
|
||||
|
||||
Reference in New Issue
Block a user