diff options
author | Ted Trask <ttrask01@yahoo.com> | 2010-01-04 14:24:29 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2010-01-04 14:24:29 +0000 |
commit | eaa04340a159c0ba366a787883d2dabfa803093a (patch) | |
tree | 7ef3b32dbe34d320c72d502aec671425ab8c5465 | |
parent | 854877f4e0f6ab059d305fa7d32871051ee4338f (diff) | |
download | acf-tinydns-eaa04340a159c0ba366a787883d2dabfa803093a.tar.bz2 acf-tinydns-eaa04340a159c0ba366a787883d2dabfa803093a.tar.xz |
Fixed bug displaying perms result, made auth field by prefix..controller.
Plus, removed role sorting.
-rw-r--r-- | tinydns-listpermissions-html.lsp | 2 | ||||
-rw-r--r-- | tinydns-model.lua | 17 |
2 files changed, 9 insertions, 10 deletions
diff --git a/tinydns-listpermissions-html.lsp b/tinydns-listpermissions-html.lsp index 195d3dc..8c621b2 100644 --- a/tinydns-listpermissions-html.lsp +++ b/tinydns-listpermissions-html.lsp @@ -1,7 +1,7 @@ <% local view, viewlibrary, page_info, session = ... %> <% require("viewfunctions") %> -<% displaycommandresults({"edituserpermisisons", "editrolepermissions"}, session) %> +<% displaycommandresults({"edituserpermissions", "editrolepermissions"}, session) %> <H1><%= html.html_escape(view.label) %></H1> diff --git a/tinydns-model.lua b/tinydns-model.lua index a4fd0e5..59a2f9a 100644 --- a/tinydns-model.lua +++ b/tinydns-model.lua @@ -106,7 +106,7 @@ end local function getallowedlist(self, userid) local allowedlist = {} - local entry = authenticator.auth.read_entry(self, authenticator.usertable, processname, userid) or "" + local entry = authenticator.auth.read_entry(self, authenticator.usertable, self.conf.prefix..self.conf.controller, userid) or "" for x in string.gmatch(entry, "([^,]+),?") do allowedlist[#allowedlist + 1] = x end -- also check to see if there are allowed files for this user's roles @@ -114,7 +114,7 @@ local function getallowedlist(self, userid) -- add in the guest role rols.value[#rols.value + 1] = roles.guest_role for i,role in ipairs(rols.value) do - local entry = authenticator.auth.read_entry(self, authenticator.roletable, processname, role) or "" + local entry = authenticator.auth.read_entry(self, authenticator.roletable, self.conf.prefix..self.conf.controller, role) or "" for x in string.gmatch(entry, "([^,]+),?") do allowedlist[#allowedlist + 1] = x end end return allowedlist @@ -332,7 +332,7 @@ function getpermissionslist(self) local userlist = {} for i,user in ipairs(users) do local allowedlist = {} - local entry = authenticator.auth.read_entry(self, authenticator.usertable, processname, user) or "" + local entry = authenticator.auth.read_entry(self, authenticator.usertable, self.conf.prefix..self.conf.controller, user) or "" for x in string.gmatch(entry, "([^,]+),?") do allowedlist[#allowedlist + 1] = x end userlist[#userlist + 1] = {id=user, allowed=allowedlist} end @@ -341,12 +341,11 @@ function getpermissionslist(self) local rols = roles.list_all_roles(self) for i,role in ipairs(rols) do local allowedlist = {} - local entry = authenticator.auth.read_entry(self, authenticator.roletable, processname, role) or "" + local entry = authenticator.auth.read_entry(self, authenticator.roletable, self.conf.prefix..self.conf.controller, role) or "" for x in string.gmatch(entry, "([^,]+),?") do allowedlist[#allowedlist + 1] = x end rolelist[#rolelist + 1] = {id=role, allowed=allowedlist} end table.sort(userlist, function(a,b) return a.id < b.id end) - table.sort(rolelist, function(a,b) return a.id < b.id end) return cfe({ type="structure", value={user=userlist, role=rolelist}, label="TinyDNS Permissions" }) end @@ -382,7 +381,7 @@ end function getuserpermissions(self, userid) local allowedlist = {} - local entry = authenticator.auth.read_entry(self, authenticator.usertable, processname, userid) or "" + local entry = authenticator.auth.read_entry(self, authenticator.usertable, self.conf.prefix..self.conf.controller, userid) or "" for x in string.gmatch(entry, "([^,]+),?") do allowedlist[#allowedlist + 1] = x end local cnffile = {} recursedir(configdir, cnffile) @@ -400,7 +399,7 @@ function setuserpermissions(self, userpermissions) local success, userpermissions = validateuserpermissions(self, userpermissions) if success then - authenticator.auth.write_entry(self, authenticator.usertable, processname, userpermissions.value.userid.value, table.concat(userpermissions.value.allowed.value, ",")) + authenticator.auth.write_entry(self, authenticator.usertable, self.conf.prefix..self.conf.controller, userpermissions.value.userid.value, table.concat(userpermissions.value.allowed.value, ",")) else userpermissions.errtxt = "Failed to set user permissions" end @@ -409,7 +408,7 @@ end function getrolepermissions(self, role) local allowedlist = {} - local entry = authenticator.auth.read_entry(self, authenticator.roletable, processname, role) or "" + local entry = authenticator.auth.read_entry(self, authenticator.roletable, self.conf.prefix..self.conf.controller, role) or "" for x in string.gmatch(entry, "([^,]+),?") do allowedlist[#allowedlist + 1] = x end local cnffile = {} recursedir(configdir, cnffile) @@ -427,7 +426,7 @@ function setrolepermissions(self, rolepermissions) local success, rolepermissions = validaterolepermissions(self, rolepermissions) if success then - authenticator.auth.write_entry(self, authenticator.roletable, processname, rolepermissions.value.role.value, table.concat(rolepermissions.value.allowed.value, ",")) + authenticator.auth.write_entry(self, authenticator.roletable, self.conf.prefix..self.conf.controller, rolepermissions.value.role.value, table.concat(rolepermissions.value.allowed.value, ",")) else rolepermissions.errtxt = "Failed to set role permissions" end |