1
0

Added a WebAdmin interface to view users their groups, and the permissions of groups.

cChunk::Tick did an assertion in cCSLock, I used a cCSUnlock to fix it, but not sure if this is correct.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@194 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
faketruth
2012-01-30 16:47:26 +00:00
parent 51dc47bc70
commit 9dfa0f1f15
12 changed files with 185 additions and 22 deletions

View File

@@ -732,8 +732,11 @@ bool cPlayer::MoveToWorld( const char* a_WorldName )
return false;
}
bool cPlayer::LoadFromDisk() // TODO - This should also get/set/whatever the correct world for this player
void cPlayer::LoadPermissionsFromDisk()
{
m_pState->Groups.clear();
m_pState->Permissions.clear();
cIniFile IniFile("users.ini");
if( IniFile.ReadFile() )
{
@@ -759,6 +762,11 @@ bool cPlayer::LoadFromDisk() // TODO - This should also get/set/whatever the cor
AddToGroup("Default");
}
ResolvePermissions();
}
bool cPlayer::LoadFromDisk() // TODO - This should also get/set/whatever the correct world for this player
{
LoadPermissionsFromDisk();
// Log player permissions, cause it's what the cool kids do
LOGINFO("Player %s has permissions:", m_pState->PlayerName.c_str() );
@@ -891,6 +899,19 @@ const cPlayer::GroupList & cPlayer::GetGroups()
return m_pState->Groups;
}
cPlayer::StringList cPlayer::GetResolvedPermissions()
{
StringList Permissions;
const PermissionMap& ResolvedPermissions = m_pState->ResolvedPermissions;
for( PermissionMap::const_iterator itr = ResolvedPermissions.begin(); itr != ResolvedPermissions.end(); ++itr )
{
if( itr->second ) Permissions.push_back( itr->first );
}
return Permissions;
}
const char* cPlayer::GetLoadedWorldName()
{
return m_pState->LoadedWorldName.c_str();