diff options
Diffstat (limited to 'tinydns-model.lua')
-rw-r--r-- | tinydns-model.lua | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tinydns-model.lua b/tinydns-model.lua index a9abb90..325e67e 100644 --- a/tinydns-model.lua +++ b/tinydns-model.lua @@ -95,7 +95,7 @@ end local function getallowedlist(self, userid) local allowedlist = {} - local entry = authenticator.read_userentry(self, "tinydns", userid) or "" + local entry = authenticator.auth.read_entry(self, authenticator.usertable, "tinydns", 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 @@ -103,7 +103,7 @@ local function getallowedlist(self, userid) -- add in the ALL role rols.value[#rols.value + 1] = "ALL" for i,role in ipairs(rols.value) do - local entry = authenticator.read_roleentry(self, "tinydns", role) or "" + local entry = authenticator.auth.read_entry(self, authenticator.roletable, "tinydns", role) or "" for x in string.gmatch(entry, "([^,]+),?") do allowedlist[#allowedlist + 1] = x end end return allowedlist @@ -337,7 +337,7 @@ function getpermissionslist(self) local userlist = {} for i,user in ipairs(users) do local allowedlist = {} - local entry = authenticator.read_userentry(self, "tinydns", user) or "" + local entry = authenticator.auth.read_entry(self, authenticator.usertable, "tinydns", user) or "" for x in string.gmatch(entry, "([^,]+),?") do allowedlist[#allowedlist + 1] = x end userlist[#userlist + 1] = {id=user, allowed=allowedlist} end @@ -346,7 +346,7 @@ function getpermissionslist(self) local rols = roles.list_all_roles(self) for i,role in ipairs(rols) do local allowedlist = {} - local entry = authenticator.read_roleentry(self, "tinydns", role) or "" + local entry = authenticator.auth.read_entry(self, authenticator.roletable, "tinydns", role) or "" for x in string.gmatch(entry, "([^,]+),?") do allowedlist[#allowedlist + 1] = x end rolelist[#rolelist + 1] = {id=role, allowed=allowedlist} end @@ -387,7 +387,7 @@ end function getuserpermissions(self, userid) local allowedlist = {} - local entry = authenticator.read_userentry(self, "tinydns", userid) or "" + local entry = authenticator.auth.read_entry(self, authenticator.usertable, "tinydns", userid) or "" for x in string.gmatch(entry, "([^,]+),?") do allowedlist[#allowedlist + 1] = x end local cnffile = {} recursedir(configdir, cnffile) @@ -402,7 +402,7 @@ function setuserpermissions(self, userpermissions) local success, userpermissions = validateuserpermissions(self, userpermissions) if success then - authenticator.write_userentry(self, "tinydns", userpermissions.value.userid.value, table.concat(userpermissions.value.allowed.value, ",")) + authenticator.auth.write_entry(self, authenticator.usertable, "tinydns", userpermissions.value.userid.value, table.concat(userpermissions.value.allowed.value, ",")) else userpermissions.errtxt = "Failed to set user permissions" end @@ -411,7 +411,7 @@ end function getrolepermissions(self, role) local allowedlist = {} - local entry = authenticator.read_roleentry(self, "tinydns", role) or "" + local entry = authenticator.auth.read_entry(self, authenticator.roletable, "tinydns", role) or "" for x in string.gmatch(entry, "([^,]+),?") do allowedlist[#allowedlist + 1] = x end local cnffile = {} recursedir(configdir, cnffile) @@ -426,7 +426,7 @@ function setrolepermissions(self, rolepermissions) local success, rolepermissions = validaterolepermissions(self, rolepermissions) if success then - authenticator.write_roleentry(self, "tinydns", rolepermissions.value.role.value, table.concat(rolepermissions.value.allowed.value, ",")) + authenticator.auth.write_entry(self, authenticator.roletable, "tinydns", rolepermissions.value.role.value, table.concat(rolepermissions.value.allowed.value, ",")) else rolepermissions.errtxt = "Failed to set role permissions" end |