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-model.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'tinydns-model.lua') 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