1
0

Improvements:

Adds a function in cRoot that allows you to reload all the groups permissions.
Note: Players don't automatically load their new permissions.
You can use cPlayer::LoadPermissionsFromDisk for that.
This commit is contained in:
STRWarrior
2014-02-05 18:10:08 +01:00
parent 70e48960ac
commit 7c750914f0
6 changed files with 69 additions and 22 deletions

View File

@@ -44,6 +44,18 @@ cGroupManager::cGroupManager()
: m_pState( new sGroupManagerState )
{
LOGD("-- Loading Groups --");
LoadGroups();
LOGD("-- Groups Successfully Loaded --");
}
void cGroupManager::LoadGroups()
{
cIniFile IniFile;
if (!IniFile.ReadFile("groups.ini"))
{
@@ -71,8 +83,10 @@ cGroupManager::cGroupManager()
unsigned int NumKeys = IniFile.GetNumKeys();
for (size_t i = 0; i < NumKeys; i++)
{
std::string KeyName = IniFile.GetKeyName( i );
AString KeyName = IniFile.GetKeyName( i );
cGroup* Group = GetGroup( KeyName.c_str() );
Group->ClearPermission(); // Needed in case the groups are reloaded.
LOGD("Loading group: %s", KeyName.c_str() );
@@ -107,7 +121,7 @@ cGroupManager::cGroupManager()
}
}
std::string Groups = IniFile.GetValue(KeyName, "Inherits", "");
AString Groups = IniFile.GetValue(KeyName, "Inherits", "");
if (!Groups.empty())
{
AStringVector Split = StringSplitAndTrim(Groups, ",");
@@ -117,13 +131,8 @@ cGroupManager::cGroupManager()
}
}
}
LOGD("-- Groups Successfully Loaded --");
}
cGroup* cGroupManager::GetGroup( const AString & a_Name )
{
GroupMap::iterator itr = m_pState->Groups.find( a_Name );