From 9dfa0f1f15c413540e932a04e94419a8a3b37dcf Mon Sep 17 00:00:00 2001 From: faketruth Date: Mon, 30 Jan 2012 16:47:26 +0000 Subject: 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 --- source/cPlayer.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'source/cPlayer.cpp') diff --git a/source/cPlayer.cpp b/source/cPlayer.cpp index c7ef8e56d..c3ba32840 100644 --- a/source/cPlayer.cpp +++ b/source/cPlayer.cpp @@ -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(); -- cgit v1.2.3