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 --- Plugins/Core/web_permissions.lua | 79 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 Plugins/Core/web_permissions.lua (limited to 'Plugins/Core/web_permissions.lua') diff --git a/Plugins/Core/web_permissions.lua b/Plugins/Core/web_permissions.lua new file mode 100644 index 000000000..5c7527056 --- /dev/null +++ b/Plugins/Core/web_permissions.lua @@ -0,0 +1,79 @@ +local function ShowUsersTable() + local Content = "

Users

" + + local UsersIni = cIniFile("users.ini") + if( UsersIni:ReadFile() == false ) then + return "Could not read users.ini!" + end + + local NumUsers = UsersIni:GetNumKeys() + + Content = Content .. "" + + if( NumUsers > 0 ) then + Content = Content .. "" + + for i=0, NumUsers-1 do + local UserName = UsersIni:GetKeyName( i ) + + Content = Content .. "" + Content = Content .. "" + Content = Content .. "" + Content = Content .. "" + Content = Content .. "" + end + else + Content = Content .. "" + end + Content = Content .. "
UserGroups
" .. i .. "." .. UserName .. "" + Content = Content .. UsersIni:GetValue( UserName, "Groups", "-" ) + Content = Content .. "
None
" + + + return Content +end + +local function ShowGroupsTable() + local Content = "

Groups

" + + local GroupsIni = cIniFile("groups.ini") + if( GroupsIni:ReadFile() == false ) then + return "Could not read groups.ini!" + end + + local NumGroups = GroupsIni:GetNumKeys() + + Content = Content .. "" + if( NumGroups > 0 ) then + Content = Content .. "" + + for i=0, NumGroups-1 do + local GroupName = GroupsIni:GetKeyName( i ) + + Content = Content .. "" + Content = Content .. "" + Content = Content .. "" + Content = Content .. "" + Content = Content .. "" + Content = Content .. "" + end + else + Content = Content .. "" + end + Content = Content .. "
NamePermissionsColor
" .. i .. "." .. GroupName .. "" + Content = Content .. GroupsIni:GetValue( GroupName, "Permissions", "-" ) + Content = Content .. "" + Content = Content .. GroupsIni:GetValue( GroupName, "Color", "-" ) + Content = Content .. "
None
" + + return Content +end + +function HandleRequest_Permissions( Request ) + local Content = "" + + Content = Content .. ShowGroupsTable() + Content = Content .. ShowUsersTable() + + return Content +end \ No newline at end of file -- cgit v1.2.3