@@ -14,7 +14,7 @@ function aSetupACL()
1414 local node = xmlLoadFile (" conf\\ ACL.xml" )
1515
1616 if (not node ) then
17- outputDebugString (" Vanilla ACL not found! Please reinstall the admin resource" )
17+ outputDebugString (" Vanilla ACL not found! Please reinstall the admin resource" )
1818 return false
1919 end
2020
@@ -122,14 +122,15 @@ function getResourceSettings(resName, bCountOnly)
122122 return {}, count
123123 end
124124 local settings = {}
125+ local safeResName = string.gsub (resName , ' ([^%w])' , ' %%%1' )
126+ local namePattern = ' ^' .. safeResName .. ' %.(.*)$'
125127
126128 for rawname , value in pairs (rawsettings ) do
127129 if (allowedTypes [type (value )]) then
128130 if allowedAccess [string.sub (rawname , 1 , 1 )] then
129131 count = count + 1
130132 local temp = string.gsub (rawname , ' ^[%*%#%@](.*)' , ' %1' )
131- local safeResName = string.gsub (resName , ' ([^%w])' , ' %%%1' )
132- local name = string.gsub (temp , ' ^' .. safeResName .. ' %.(.*)$' , ' %1' )
133+ local name = string.gsub (temp , namePattern , ' %1' )
133134 local bIsDefault = (temp == name )
134135 if (not settings [name ]) then
135136 settings [name ] = {}
@@ -171,7 +172,7 @@ local aACLFunctions = {
171172 if (action == ACL_ADD ) then
172173 if (name and type (name ) == " string" ) then
173174 if (aclCreateGroup (name )) then
174- messageBox (client , " Successfully created group '" .. name .. " '" , MB_INFO )
175+ messageBox (client , " Successfully created group '" .. name .. " '" , MB_INFO )
175176 else
176177 messageBox (client , " Failed to create group '" .. name .. " '" , MB_INFO )
177178 end
@@ -182,7 +183,7 @@ local aACLFunctions = {
182183 if (aclDestroyGroup (name )) then
183184 messageBox (client , " Successfully removed group '" .. name .. " '" , MB_INFO )
184185 else
185- messageBox (client , " Failed to remove group '" .. name .. " '" , MB_INFO )
186+ messageBox (client , " Failed to remove group '" .. name .. " '" , MB_INFO )
186187 end
187188 end
188189 messageBox (client , " Invalid group name" , MB_INFO )
@@ -207,13 +208,13 @@ local aACLFunctions = {
207208 if (aclGroupRemoveObject (aclGetGroup (group ), object )) then
208209 messageBox (client , " Successfully removed user '" .. object :gsub (' user.' ,' ' ).. " ' from the '" .. group .. " ' ACL group" , MB_INFO )
209210 else
210- messageBox (client , " Failed to remove user '" .. object :gsub (' user.' ,' ' ).. " ' from the '" .. group .. " ' ACL group" , MB_INFO )
211+ messageBox (client , " Failed to remove user '" .. object :gsub (' user.' ,' ' ).. " ' from the '" .. group .. " ' ACL group" , MB_INFO )
211212 end
212213 elseif (action == ACL_ADD ) then
213214 if (aclGroupAddObject (aclGetGroup (group ), ' user.' .. object )) then
214215 messageBox (client , " Successfully added user '" .. object :gsub (' user.' ,' ' ).. " ' to the '" .. group .. " ' ACL group" , MB_INFO )
215216 else
216- messageBox (client , " Failed to add user '" .. object :gsub (' user.' ,' ' ).. " ' to the '" .. group .. " ' ACL group" , MB_INFO )
217+ messageBox (client , " Failed to add user '" .. object :gsub (' user.' ,' ' ).. " ' to the '" .. group .. " ' ACL group" , MB_INFO )
217218 end
218219 end
219220 end ,
@@ -231,13 +232,13 @@ local aACLFunctions = {
231232 if (aclGroupRemoveObject (aclGetGroup (group ), object )) then
232233 messageBox (client , " Successfully removed resource '" .. object :gsub (' resource.' ,' ' ).. " ' from the '" .. group .. " ' ACL group" , MB_INFO )
233234 else
234- messageBox (client , " Failed to remove resource '" .. object :gsub (' resource.' ,' ' ).. " ' from the '" .. group .. " ' ACL group" , MB_INFO )
235+ messageBox (client , " Failed to remove resource '" .. object :gsub (' resource.' ,' ' ).. " ' from the '" .. group .. " ' ACL group" , MB_INFO )
235236 end
236237 elseif (action == ACL_ADD ) then
237238 if (aclGroupAddObject (aclGetGroup (group ), ' resource.' .. object )) then
238239 messageBox (client , " Successfully added resource '" .. object :gsub (' resource.' ,' ' ).. " ' to the '" .. group .. " ' ACL group" , MB_INFO )
239240 else
240- messageBox (client , " Failed to add resource '" .. object :gsub (' resource.' ,' ' ).. " ' to the '" .. group .. " ' ACL group" , MB_INFO )
241+ messageBox (client , " Failed to add resource '" .. object :gsub (' resource.' ,' ' ).. " ' to the '" .. group .. " ' ACL group" , MB_INFO )
241242 end
242243 end
243244 end ,
0 commit comments