Fixed case where a non-super user shell denied market data after bring left up through a server restart
This commit is contained in:
1 parent
7b833087e5
commit
baaa3c4f98
4 files changed
+12
-7
No files matched your search
@@ -80,7 +80,7 @@ bool AuthSessionManager::validate_ip_port(const bts::config::KeyCode& kc)
|
||||
return portgood && ipgood;
|
||||
}
|
||||
|
||||
bool AuthSessionManager::add_or_replace_session(const api::user::TokenPayload& tok, const admin::BTSUser& user, std::string* msg)
|
||||
bool AuthSessionManager::add_or_replace_session(const api::user::TokenPayload& tok, const std::string& username, std::string* msg)
|
||||
{
|
||||
if(tok.wheel())
|
||||
return true;
|
||||
@@ -105,18 +105,18 @@ bool AuthSessionManager::add_or_replace_session(const api::user::TokenPayload& t
|
||||
if(it != _map.end())
|
||||
{
|
||||
_map[tok.id()] = Session{tok};
|
||||
LOG(User, Warn, "KEYCODE: Replacing session {} user:{}:{} ", tok.id(), user.id(), user.name());
|
||||
LOG(User, Warn, "KEYCODE: Replacing session {} user:{} ", tok.id(), username);
|
||||
return true;
|
||||
}
|
||||
else if(_map.size() < _nusers)
|
||||
{
|
||||
_map[tok.id()] = Session{tok};
|
||||
LOG(User, Warn, "KEYCODE: Creating session {} user:{}:{}", tok.id(), user.id(), user.name());
|
||||
LOG(User, Warn, "KEYCODE: Creating session {} user:{}", tok.id(), username);
|
||||
return true;
|
||||
}
|
||||
if(msg)
|
||||
*msg = "KEYCODES: Not Enough Logins available for session";
|
||||
LOG(User, Error, "KEYCODES: Not Enough Logins available for session {} user:{}:{}", tok.id(), user.id(), user.name());
|
||||
LOG(User, Error, "KEYCODES: Not Enough Logins available for session {} user:{}", tok.id(), username);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -134,6 +134,10 @@ bool AuthSessionManager::check_session(const api::user::TokenPayload& tok)
|
||||
bool same_token = _concurrent || (tok.date() == it->second.token.date());
|
||||
return not_expired && same_token;
|
||||
}
|
||||
else //not in map, try to login in case server booted
|
||||
{
|
||||
return add_or_replace_session(tok);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user