From 170b975a25e0ad6fded62d48b87a2c165fa46c1b Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Mon, 10 Nov 2008 19:32:54 +0000 Subject: Slight change to tinydns to be more flexible with naming. git-svn-id: svn://svn.alpinelinux.org/acf/tinydns/trunk@1589 ab2d0c66-481e-0410-8bed-d214d4d58bed --- tinydns-listfiles-html.lsp | 8 ++++---- tinydns-model.lua | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tinydns-listfiles-html.lsp b/tinydns-listfiles-html.lsp index b3613ce..4286122 100644 --- a/tinydns-listfiles-html.lsp +++ b/tinydns-listfiles-html.lsp @@ -25,10 +25,10 @@ io.write("") <% - if session.permissions.tinydns.delete then io.write(html.link{value = "delete?filename=" .. file.value.filename.value, label="Delete " }) end + if session.permissions[page_info.controller].delete then io.write(html.link{value = "delete?filename=" .. file.value.filename.value, label="Delete " }) end io.write(html.link{value = "view?filename=" .. file.value.filename.value, label="View " }) - if session.permissions.tinydns.edit then io.write(html.link{value = "edit?filename=" .. file.value.filename.value.."&redir="..page_info.orig_action, label="Edit " }) end - if session.permissions.tinydns.editfile then io.write(html.link{value = "editfile?filename=" .. file.value.filename.value.."&redir="..page_info.orig_action, label="Expert " }) end + if session.permissions[page_info.controller].edit then io.write(html.link{value = "edit?filename=" .. file.value.filename.value.."&redir="..page_info.orig_action, label="Edit " }) end + if session.permissions[page_info.controller].editfile then io.write(html.link{value = "editfile?filename=" .. file.value.filename.value.."&redir="..page_info.orig_action, label="Expert " }) end %> <%= file.value.filesize.value %> @@ -38,7 +38,7 @@ io.write("") <% end %> -<% if viewlibrary and viewlibrary.dispatch_component and session.permissions.tinydns.newfile then +<% if viewlibrary and viewlibrary.dispatch_component and session.permissions[page_info.controller].newfile then local newfileform = viewlibrary.dispatch_component("newfile", nil, true) %>

Create new Domain

<% diff --git a/tinydns-model.lua b/tinydns-model.lua index 0e0c319..360e3d3 100644 --- a/tinydns-model.lua +++ b/tinydns-model.lua @@ -96,7 +96,7 @@ end local function getallowedlist(self, userid) local allowedlist = {} - local entry = authenticator.auth.read_entry(self, authenticator.usertable, "tinydns", userid) or "" + local entry = authenticator.auth.read_entry(self, authenticator.usertable, processname, 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 @@ -104,7 +104,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, "tinydns", role) or "" + local entry = authenticator.auth.read_entry(self, authenticator.roletable, processname, role) or "" for x in string.gmatch(entry, "([^,]+),?") do allowedlist[#allowedlist + 1] = x end end return allowedlist @@ -325,7 +325,7 @@ function getpermissionslist(self) local userlist = {} for i,user in ipairs(users) do local allowedlist = {} - local entry = authenticator.auth.read_entry(self, authenticator.usertable, "tinydns", user) or "" + local entry = authenticator.auth.read_entry(self, authenticator.usertable, processname, user) or "" for x in string.gmatch(entry, "([^,]+),?") do allowedlist[#allowedlist + 1] = x end userlist[#userlist + 1] = {id=user, allowed=allowedlist} end @@ -334,7 +334,7 @@ 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, "tinydns", role) or "" + local entry = authenticator.auth.read_entry(self, authenticator.roletable, processname, role) or "" for x in string.gmatch(entry, "([^,]+),?") do allowedlist[#allowedlist + 1] = x end rolelist[#rolelist + 1] = {id=role, allowed=allowedlist} end @@ -375,7 +375,7 @@ end function getuserpermissions(self, userid) local allowedlist = {} - local entry = authenticator.auth.read_entry(self, authenticator.usertable, "tinydns", userid) or "" + local entry = authenticator.auth.read_entry(self, authenticator.usertable, processname, userid) or "" for x in string.gmatch(entry, "([^,]+),?") do allowedlist[#allowedlist + 1] = x end local cnffile = {} recursedir(configdir, cnffile) @@ -390,7 +390,7 @@ function setuserpermissions(self, userpermissions) local success, userpermissions = validateuserpermissions(self, userpermissions) if success then - authenticator.auth.write_entry(self, authenticator.usertable, "tinydns", userpermissions.value.userid.value, table.concat(userpermissions.value.allowed.value, ",")) + authenticator.auth.write_entry(self, authenticator.usertable, processname, userpermissions.value.userid.value, table.concat(userpermissions.value.allowed.value, ",")) else userpermissions.errtxt = "Failed to set user permissions" end @@ -399,7 +399,7 @@ end function getrolepermissions(self, role) local allowedlist = {} - local entry = authenticator.auth.read_entry(self, authenticator.roletable, "tinydns", role) or "" + local entry = authenticator.auth.read_entry(self, authenticator.roletable, processname, role) or "" for x in string.gmatch(entry, "([^,]+),?") do allowedlist[#allowedlist + 1] = x end local cnffile = {} recursedir(configdir, cnffile) @@ -414,7 +414,7 @@ function setrolepermissions(self, rolepermissions) local success, rolepermissions = validaterolepermissions(self, rolepermissions) if success then - authenticator.auth.write_entry(self, authenticator.roletable, "tinydns", rolepermissions.value.role.value, table.concat(rolepermissions.value.allowed.value, ",")) + authenticator.auth.write_entry(self, authenticator.roletable, processname, rolepermissions.value.role.value, table.concat(rolepermissions.value.allowed.value, ",")) else rolepermissions.errtxt = "Failed to set role permissions" end -- cgit v1.2.3