1
0
mirror of https://bitbucket.org/seefoe/src.git synced 2026-01-16 23:04:30 -05:00

Removed admin table dependence on station ids

This commit is contained in:
seefo
2018-04-15 11:10:31 -04:00
parent fbf2b0ca93
commit 49b4a4f24b
3 changed files with 11 additions and 18 deletions

View File

@@ -1924,7 +1924,7 @@ float Client::computeDeltaTimeInSeconds(uint32 const syncStampLong) const {
bool Client::setGodMode(bool value) {
// (re?) check god permissions
m_godLevel = AdminAccountManager::isAdminAccount(getStationId(), ConfigServerGame::getUseOldSuidGenerator());
m_godLevel = AdminAccountManager::getAdminLevel(m_accountName.c_str());
if (ConfigServerGame::getAdminGodToAll() || (m_godLevel > 0)) {
m_godValidated = true;

View File

@@ -64,25 +64,18 @@ const std::string & AdminAccountManager::getAdminTagName()
//-----------------------------------------------------------------------
// if they are in the iff and have a level set, return it
int AdminAccountManager::isAdminAccount(uint32 suid, bool useOldSuid)
int AdminAccountManager::getAdminLevel(const std::string & account)
{
DEBUG_FATAL(!ms_installed, ("AdminAccountManager not installed"));
int level = 0;
DEBUG_FATAL(!ms_installed, ("AdminAccountManager not installed"));
int columnNumber = -1;
int columnNumber = ms_adminTable->findColumnNumber("AdminAccounts");
DEBUG_FATAL(columnNumber == -1, ("Error loading admin table...no account column"));
int row = ms_adminTable->searchColumnString( columnNumber, account);
if (row == -1) return 0;
if (!useOldSuid) {
columnNumber = ms_adminTable->findColumnNumber("AdminSuid");
} else {
columnNumber = ms_adminTable->findColumnNumber("OldAdminSuid");
}
DEBUG_FATAL(columnNumber == -1, ("Error loading admin table...no account column"));
int row = ms_adminTable->searchColumnInt(columnNumber, suid);
if (row == -1)
return false;
return (int) ms_adminTable->getIntValue("AdminLevel", row);
level = ms_adminTable->getIntValue("AdminLevel", row);
return level;
}
bool AdminAccountManager::isAdminAccount(const std::string & account, int& level)

View File

@@ -19,7 +19,7 @@ public:
static const char *getAdminCommandName();
static const std::string & getAdminTagName();
static int isAdminAccount(uint32 suid, bool useOldSuid = false);
static int getAdminLevel(const std::string & account);
static bool isAdminAccount(const std::string & account, int& level);
static bool isInternalIp(const std::string & addr);
static void reload();