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/ManualBindings.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'source/ManualBindings.cpp') diff --git a/source/ManualBindings.cpp b/source/ManualBindings.cpp index 45fae285d..06a148b91 100644 --- a/source/ManualBindings.cpp +++ b/source/ManualBindings.cpp @@ -140,6 +140,27 @@ static int tolua_cPlayer_GetGroups(lua_State* tolua_S) return 1; } +static int tolua_cPlayer_GetResolvedPermissions(lua_State* tolua_S) +{ + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + + cPlayer::StringList AllPermissions = self->GetResolvedPermissions(); + + lua_createtable(tolua_S, AllPermissions.size(), 0); + int newTable = lua_gettop(tolua_S); + int index = 1; + cPlayer::StringList::iterator iter = AllPermissions.begin(); + while(iter != AllPermissions.end()) + { + std::string& Permission = *iter; + tolua_pushstring( tolua_S, Permission.c_str() ); + lua_rawseti(tolua_S, newTable, index); + ++iter; + ++index; + } + return 1; +} + static int tolua_cPlugin_BindCommand(lua_State* tolua_S) { cPlugin* self = (cPlugin*) tolua_tousertype(tolua_S,1,0); @@ -267,6 +288,7 @@ void ManualBindings::Bind( lua_State* tolua_S ) tolua_endmodule(tolua_S); tolua_beginmodule(tolua_S,"cPlayer"); tolua_function(tolua_S,"GetGroups",tolua_cPlayer_GetGroups); + tolua_function(tolua_S,"GetResolvedPermissions",tolua_cPlayer_GetResolvedPermissions); tolua_endmodule(tolua_S); tolua_beginmodule(tolua_S,"cWebPlugin_Lua"); tolua_function(tolua_S,"AddTab",tolua_cWebPlugin_Lua_AddTab); -- cgit v1.2.3