mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2026-02-16 02:30:44 +00:00
forward user's role on login
This commit is contained in:
@@ -25,6 +25,7 @@ int DEFAULT_PORT = 4444;
|
|||||||
bool Terminate = false;
|
bool Terminate = false;
|
||||||
bool LoginAuth = false;
|
bool LoginAuth = false;
|
||||||
std::string Username = "";
|
std::string Username = "";
|
||||||
|
std::string UserRole = "";
|
||||||
std::string UlStatus;
|
std::string UlStatus;
|
||||||
std::string MStatus;
|
std::string MStatus;
|
||||||
bool ModLoaded;
|
bool ModLoaded;
|
||||||
@@ -127,7 +128,7 @@ void Parse(std::string Data,SOCKET CSocket){
|
|||||||
break;
|
break;
|
||||||
case 'N':
|
case 'N':
|
||||||
if (SubCode == 'c'){
|
if (SubCode == 'c'){
|
||||||
Data = "N{\"Auth\":"+std::to_string(LoginAuth)+",\"username\":\"" + Username + "\"}";
|
Data = "N{\"Auth\":"+std::to_string(LoginAuth)+",\"username\":\"" + Username + "\",\"role\":\"" + UserRole + "\"}";
|
||||||
}else{
|
}else{
|
||||||
Data = "N" + Login(Data.substr(Data.find(':') + 1));
|
Data = "N" + Login(Data.substr(Data.find(':') + 1));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ std::string PublicKey;
|
|||||||
std::string PrivateKey;
|
std::string PrivateKey;
|
||||||
extern bool LoginAuth;
|
extern bool LoginAuth;
|
||||||
extern std::string Username;
|
extern std::string Username;
|
||||||
|
extern std::string UserRole;
|
||||||
std::string Role;
|
std::string Role;
|
||||||
|
|
||||||
void UpdateKey(const char* newKey){
|
void UpdateKey(const char* newKey){
|
||||||
@@ -69,6 +70,9 @@ std::string Login(const std::string& fields){
|
|||||||
if (d.contains("username")) {
|
if (d.contains("username")) {
|
||||||
Username = d["username"].get<std::string>();
|
Username = d["username"].get<std::string>();
|
||||||
}
|
}
|
||||||
|
if (d.contains("role")) {
|
||||||
|
UserRole = d["role"].get<std::string>();
|
||||||
|
}
|
||||||
if(d.contains("private_key")) {
|
if(d.contains("private_key")) {
|
||||||
UpdateKey(d["private_key"].get<std::string>().c_str());
|
UpdateKey(d["private_key"].get<std::string>().c_str());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user