mirror of
https://github.com/mangosfour/server.git
synced 2025-12-18 01:37:01 +00:00
[9518] Implement account associated execute for RA commands
* Now at login by RA-connection RA-connection use account id/access level
for commands execute. So at login with moderator access by RA-connection you
can execute only moderator level commands. For administrator level accounts
allowed execute only console level commands if new config option RA.Stricted = 0.
For security reasons by default RA.Stricted = 1.
* RA-connection executed commands now logged for associalted account id
* Some own account related commands allowed execute in RA-connection
NOTE: config version updated because RA.Stricted = 1 not compatible with old
way work and this can break tools thta use RA-access if it not disabled.
Yuo will need update mangosd.conf.
This commit is contained in:
parent
39559fc73a
commit
7fdbe497e9
13 changed files with 114 additions and 58 deletions
|
|
@ -55,7 +55,7 @@ bool ChatHandler::HandleCommandsCommand(const char* /*args*/)
|
|||
|
||||
bool ChatHandler::HandleAccountCommand(const char* /*args*/)
|
||||
{
|
||||
AccountTypes gmlevel = m_session->GetSecurity();
|
||||
AccountTypes gmlevel = GetAccessLevel();
|
||||
PSendSysMessage(LANG_ACCOUNT_LEVEL, uint32(gmlevel));
|
||||
return true;
|
||||
}
|
||||
|
|
@ -134,7 +134,7 @@ bool ChatHandler::HandleSaveCommand(const char* /*args*/)
|
|||
Player *player=m_session->GetPlayer();
|
||||
|
||||
// save GM account without delay and output message (testing, etc)
|
||||
if(m_session->GetSecurity() > SEC_PLAYER)
|
||||
if(GetAccessLevel() > SEC_PLAYER)
|
||||
{
|
||||
player->SaveToDB();
|
||||
SendSysMessage(LANG_PLAYER_SAVED);
|
||||
|
|
@ -179,6 +179,10 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/)
|
|||
|
||||
bool ChatHandler::HandleAccountPasswordCommand(const char* args)
|
||||
{
|
||||
// allow use from RA, but not from console (not have associated account id)
|
||||
if (!GetAccountId())
|
||||
return false;
|
||||
|
||||
if(!*args)
|
||||
return false;
|
||||
|
||||
|
|
@ -200,14 +204,14 @@ bool ChatHandler::HandleAccountPasswordCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!sAccountMgr.CheckPassword (m_session->GetAccountId(), password_old))
|
||||
if (!sAccountMgr.CheckPassword (GetAccountId(), password_old))
|
||||
{
|
||||
SendSysMessage (LANG_COMMAND_WRONGOLDPASSWORD);
|
||||
SetSentErrorMessage (true);
|
||||
return false;
|
||||
}
|
||||
|
||||
AccountOpResult result = sAccountMgr.ChangePassword(m_session->GetAccountId(), password_new);
|
||||
AccountOpResult result = sAccountMgr.ChangePassword(GetAccountId(), password_new);
|
||||
|
||||
switch(result)
|
||||
{
|
||||
|
|
@ -230,6 +234,10 @@ bool ChatHandler::HandleAccountPasswordCommand(const char* args)
|
|||
|
||||
bool ChatHandler::HandleAccountLockCommand(const char* args)
|
||||
{
|
||||
// allow use from RA, but not from console (not have associated account id)
|
||||
if (!GetAccountId())
|
||||
return false;
|
||||
|
||||
if (!*args)
|
||||
{
|
||||
SendSysMessage(LANG_USE_BOL);
|
||||
|
|
@ -239,14 +247,14 @@ bool ChatHandler::HandleAccountLockCommand(const char* args)
|
|||
std::string argstr = (char*)args;
|
||||
if (argstr == "on")
|
||||
{
|
||||
loginDatabase.PExecute( "UPDATE account SET locked = '1' WHERE id = '%d'",m_session->GetAccountId());
|
||||
loginDatabase.PExecute( "UPDATE account SET locked = '1' WHERE id = '%d'",GetAccountId());
|
||||
PSendSysMessage(LANG_COMMAND_ACCLOCKLOCKED);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (argstr == "off")
|
||||
{
|
||||
loginDatabase.PExecute( "UPDATE account SET locked = '0' WHERE id = '%d'",m_session->GetAccountId());
|
||||
loginDatabase.PExecute( "UPDATE account SET locked = '0' WHERE id = '%d'",GetAccountId());
|
||||
PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue