summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-10-24 15:20:36 +0000
committerTed Trask <ttrask01@yahoo.com>2008-10-24 15:20:36 +0000
commit3f46a3ee715d4f96e69c448e166d6e1732c1d235 (patch)
tree89e19f5d6b5d1beadfcb8a89c07393aee2b8d639
parente15e054084a0805f70dd307ada18018e42fcc6b4 (diff)
downloadacf-tinydns-3f46a3ee715d4f96e69c448e166d6e1732c1d235.tar.bz2
acf-tinydns-3f46a3ee715d4f96e69c448e166d6e1732c1d235.tar.xz
Minor change to roles code and major change to roles. Replaced ALL, CREATE, READ, UPDATE, and DELETE with GUEST, USER, EDITOR, EXPERT, and ADMIN. Changed all roles files and modified some html files to hide options without permissions. Determine default roles from roles files, rather than hard-coded, and added ability to modify default roles by adding permissions.
git-svn-id: svn://svn.alpinelinux.org/acf/tinydns/trunk@1563 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r--tinydns-model.lua7
-rw-r--r--tinydns.roles6
2 files changed, 8 insertions, 5 deletions
diff --git a/tinydns-model.lua b/tinydns-model.lua
index dcbe9da..006e672 100644
--- a/tinydns-model.lua
+++ b/tinydns-model.lua
@@ -7,6 +7,7 @@ require("format")
require("validator")
require("authenticator")
require("roles")
+require("posix")
-- Set variables
local configfiles = {}
@@ -100,8 +101,8 @@ local function getallowedlist(self, userid)
-- also check to see if there are allowed files for this user's roles
local rols = authenticator.get_userinfo_roles(self, userid)
- -- add in the ALL role
- rols.value[#rols.value + 1] = "ALL"
+ -- 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 ""
for x in string.gmatch(entry, "([^,]+),?") do allowedlist[#allowedlist + 1] = x end
@@ -280,7 +281,7 @@ function createconfigfile(self, configfile, userid)
path = configdir .. "/" .. path
end
if validator.is_valid_filename(path,configdir) then
- if (fs.is_file(path)) then
+ if (posix.stat(path)) then
configfile.value.filename.errtxt = "File already exists"
else
local file = io.open(path, "w")
diff --git a/tinydns.roles b/tinydns.roles
index 7872dc7..c9503c1 100644
--- a/tinydns.roles
+++ b/tinydns.roles
@@ -1,2 +1,4 @@
-READ=tinydns:status,tinydns:view
-UPDATE=tinydns:config,tinydns:listfiles,tinydns:delete,tinydns:edit,tinydns:editfile,tinydns:newfile,tinydns:startstop,tinydns:listpermissions,tinydns:edituserpermissions,tinydns:editrolepermissions
+USER=tinydns:status,tinydns:view,tinydns:listfiles,tinydns:startstop
+EDITOR=tinydns:config,tinydns:delete,tinydns:edit,tinydns:newfile
+EXPERT=tinydns:editfile
+ADMIN=tinydns:status,tinydns:view,tinydns:listfiles,tinydns:startstop,tinydns:config,tinydns:delete,tinydns:edit,tinydns:newfile,tinydns:editfile,tinydns:listpermissions,tinydns:edituserpermissions,tinydns:editrolepermissions