summaryrefslogtreecommitdiffstats
path: root/app/acf-util
diff options
context:
space:
mode:
Diffstat (limited to 'app/acf-util')
-rw-r--r--app/acf-util/acf-util.roles6
-rw-r--r--app/acf-util/logon-controller.lua8
-rw-r--r--app/acf-util/roles-editrole-html.lsp4
-rw-r--r--app/acf-util/roles-html.lsp57
-rw-r--r--app/acf-util/roles-model.lua17
-rw-r--r--app/acf-util/roles-viewroles-html.lsp10
-rw-r--r--app/acf-util/welcome-controller.lua10
-rw-r--r--app/acf-util/welcome-html.lsp9
8 files changed, 71 insertions, 50 deletions
diff --git a/app/acf-util/acf-util.roles b/app/acf-util/acf-util.roles
index b31297c..7433fcc 100644
--- a/app/acf-util/acf-util.roles
+++ b/app/acf-util/acf-util.roles
@@ -1,4 +1,4 @@
-GUEST=logon:logon,logon:logout,logon:status,welcome:read
-USER=password:editme,roles:read
+GUEST=logon/logon,logon/logout,logon/status,welcome/read
+USER=password/editme,roles/read
EXPERT=
-ADMIN=logon:logon,logon:logout,logon:status,password:editme,password:status,password:edituser,password:newuser,password:deleteuser,roles:read,roles:getpermslist,roles:viewuserroles,roles:viewroleperms,roles:viewroles,roles:editrole,roles:deleterole,roles:newrole,welcome:read,password:status,password:edituser,password:newuser,password:deleteuser,roles:getpermslist,roles:viewuserroles,roles:viewroleperms,roles:viewroles,roles:editrole,roles:deleterole,roles:newrole
+ADMIN=logon/logon,logon/logout,logon/status,password/editme,password/status,password/edituser,password/newuser,password/deleteuser,roles/read,roles/getpermslist,roles/viewuserroles,roles/viewroleperms,roles/viewroles,roles/editrole,roles/deleterole,roles/newrole,welcome/read,password/status,password/edituser,password/newuser,password/deleteuser,roles/getpermslist,roles/viewuserroles,roles/viewroleperms,roles/viewroles,roles/editrole,roles/deleterole,roles/newrole
diff --git a/app/acf-util/logon-controller.lua b/app/acf-util/logon-controller.lua
index d71d257..f1fa93d 100644
--- a/app/acf-util/logon-controller.lua
+++ b/app/acf-util/logon-controller.lua
@@ -9,17 +9,17 @@ logon = function(self)
-- If there are no users defined, add privileges and dispatch password/newuser
local users = self.model:list_users()
if #users.value == 0 then
- self.sessiondata.permissions.password = {}
- self.sessiondata.permissions.password.newuser = {"temp"}
+ self.sessiondata.permissions[self.conf.prefix].password = {}
+ self.sessiondata.permissions[self.conf.prefix].password.newuser = {"temp"}
self:dispatch(self.conf.prefix, "password", "newuser")
- self.sessiondata.permissions.password = nil
+ self.sessiondata.permissions[self.conf.prefix].password = nil
self.conf.suppress_view = true
return
end
local userid = cfe({ value=clientdata.userid or "", label="User ID" })
local password = cfe({ label="Password" })
- local redir = cfe({ value=clientdata.redir or "/welcome/read", label="" })
+ local redir = cfe({ value=clientdata.redir or "welcome/read", label="" })
local cmdresult = cfe({ type="form", value={userid=userid, password=password, redir=redir}, label="Logon", option="Logon" })
if clientdata.Logon then
local logonredirect = self.sessiondata.logonredirect
diff --git a/app/acf-util/roles-editrole-html.lsp b/app/acf-util/roles-editrole-html.lsp
index cec9af0..5d1582f 100644
--- a/app/acf-util/roles-editrole-html.lsp
+++ b/app/acf-util/roles-editrole-html.lsp
@@ -1,10 +1,6 @@
<% local form, viewtable, page_info = ... %>
<% require("viewfunctions") %>
-<% --[[
- io.write(html.cfe_unpack(form))
---]] %>
-
<H1><%= html.html_escape(form.label) %></H1>
<%
displayformstart(form, page_info)
diff --git a/app/acf-util/roles-html.lsp b/app/acf-util/roles-html.lsp
index 090421f..32000af 100644
--- a/app/acf-util/roles-html.lsp
+++ b/app/acf-util/roles-html.lsp
@@ -1,9 +1,5 @@
<% local view= ... %>
-<% --[[
- io.write(html.cfe_unpack(view))
---]] %>
-<% ---[[ %>
<% if view.value.userid then %>
<H1>Roles/Permission list for <%= html.html_escape(view.value.userid.value) %>:</H1>
<% elseif view.value.role then %>
@@ -20,9 +16,7 @@
end %>
</DL>
<% end %>
-<% --]] %>
-<% ---[[ %>
<% if view.value.permissions then %>
<% if view.value.userid then %>
<H2><%= html.html_escape(view.value.userid.value) %>'s full permissions are</H2>
@@ -30,29 +24,36 @@
<H2><%= html.html_escape(view.value.role.value) %>'s full permissions are</H2>
<% end %>
<DL>
- <% local controllers = {}
- -- It's nice to have it in alphabetical order
- for cont in pairs(view.value.permissions.value) do
- controllers[#controllers + 1] = cont
- end
- table.sort(controllers)
- io.write("<TABLE>")
- io.write("<TR><TD CLASS='header'>Controller</TD><TD CLASS='header'>Action(s)</TD>")
- for x,cont in ipairs(controllers) do
- print("<TR><TD STYLE='font-weight:bold;'>",html.html_escape(cont),"</TD><TD>")
- -- Again, alphabetical order
- local actions = {}
- for act in pairs(view.value.permissions.value[cont]) do
- actions[#actions + 1] = act
+ <TABLE>
+ <TR><TD CLASS='header'>Controller</TD><TD CLASS='header'>Action(s)</TD></TR>
+ <% local prefixes = {}
+ -- It's nice to have it in alphabetical order
+ for pref in pairs(view.value.permissions.value) do
+ prefixes[#prefixes + 1] = pref
end
- table.sort(actions)
- for y,act in pairs(actions) do
- print((html.html_escape(act)))
+ table.sort(prefixes)
+ for w,pref in ipairs(prefixes) do
+ local controllers = {}
+ -- Again, alphabetical order
+ for cont in pairs(view.value.permissions.value[pref]) do
+ controllers[#controllers + 1] = cont
+ end
+ table.sort(controllers)
+ for x,cont in ipairs(controllers) do
+ print("<TR><TD STYLE='font-weight:bold;'>",html.html_escape(pref..cont),"</TD><TD>")
+ -- Again, alphabetical order
+ local actions = {}
+ for act in pairs(view.value.permissions.value[pref][cont]) do
+ actions[#actions + 1] = act
+ end
+ table.sort(actions)
+ for y,act in pairs(actions) do
+ print((html.html_escape(act)))
+ end
+ io.write("<TD></TR>")
+ end
end
- io.write("<TD></TR>")
- end
- io.write("</TABLE>")
- %>
+ %>
+ </TABLE>
</DL>
<% end %>
-<% --]] %>
diff --git a/app/acf-util/roles-model.lua b/app/acf-util/roles-model.lua
index 79c1b14..6b12dd9 100644
--- a/app/acf-util/roles-model.lua
+++ b/app/acf-util/roles-model.lua
@@ -11,19 +11,22 @@ local get_all_permissions = function(self)
local table_perm = {}
local array_perm = {}
for a,b in pairs(controllers) do
- if nil == table_perm[b.sname] then
- table_perm[b.sname] = {}
+ if nil == table_perm[b.prefix] then
+ table_perm[b.prefix] = {}
+ end
+ if nil == table_perm[b.prefix][b.sname] then
+ table_perm[b.prefix][b.sname] = {}
end
local temp = roles.get_controllers_func(self,b)
for x,y in ipairs(temp) do
- table_perm[b.sname][y] = {}
- array_perm[#array_perm + 1] = b.sname .. ":" .. y
+ table_perm[b.prefix][b.sname][y] = {}
+ array_perm[#array_perm + 1] = b.prefix .. b.sname .. "/" .. y
end
temp = roles.get_controllers_view(self,b)
for x,y in ipairs(temp) do
- if not table_perm[b.sname][y] then
- table_perm[b.sname][y] = {}
- array_perm[#array_perm + 1] = b.sname .. ":" .. y
+ if not table_perm[b.prefix][b.sname][y] then
+ table_perm[b.prefix][b.sname][y] = {}
+ array_perm[#array_perm + 1] = b.prefix .. b.sname .. "/" .. y
end
end
end
diff --git a/app/acf-util/roles-viewroles-html.lsp b/app/acf-util/roles-viewroles-html.lsp
index 3e818fb..68aac01 100644
--- a/app/acf-util/roles-viewroles-html.lsp
+++ b/app/acf-util/roles-viewroles-html.lsp
@@ -16,24 +16,26 @@
<H2>Existing roles</H2>
<DL>
+<TABLE>
<% if view.value.default_roles then %>
<% for x,role in pairs(view.value.default_roles.value) do %>
- <dt><img src='/skins/static/tango/16x16/categories/applications-system.png' height='16' width='16'> <%= html.html_escape(role) %></dt>
+ <TR><TD><dt><img src='/skins/static/tango/16x16/categories/applications-system.png' height='16' width='16'> <%= html.html_escape(role) %></dt>
<dd>
[<a href='viewroleperms?role=<%= html.html_escape(role) %>'>View this role</a>]
[<a href='editrole?role=<%= html.html_escape(role) %>&redir=<%= html.html_escape(page_info.orig_action) %>'>Edit this role</a>]
- </dd>
+ </dd></TD></TR>
<% end %>
<% end %>
<% if view.value.defined_roles then %>
<% table.sort(view.value.defined_roles.value) %>
<% for x,role in pairs(view.value.defined_roles.value) do %>
- <dt><img src='/skins/static/tango/16x16/apps/system-users.png' height='16' width='16'> <%= html.html_escape(role) %></dt>
+ <TR><TD><dt><img src='/skins/static/tango/16x16/apps/system-users.png' height='16' width='16'> <%= html.html_escape(role) %></dt>
<dd>
[<a href='viewroleperms?role=<%= html.html_escape(role) %>'>View this role</a>]
[<a href='editrole?role=<%= html.html_escape(role) %>&redir=<%= html.html_escape(page_info.orig_action) %>'>Edit this role</a>]
[<a href='deleterole?role=<%= html.html_escape(role) %>'>Delete this role</a>]
- </dd>
+ </dd></TD></TR>
<% end %>
<% end %>
+</TABLE>
</DL>
diff --git a/app/acf-util/welcome-controller.lua b/app/acf-util/welcome-controller.lua
new file mode 100644
index 0000000..77735ec
--- /dev/null
+++ b/app/acf-util/welcome-controller.lua
@@ -0,0 +1,10 @@
+-- A standin controller for testing
+module (..., package.seeall)
+
+default_action = "read"
+
+read = function (self )
+ return ( {self = self} )
+end
+
+
diff --git a/app/acf-util/welcome-html.lsp b/app/acf-util/welcome-html.lsp
new file mode 100644
index 0000000..88bc934
--- /dev/null
+++ b/app/acf-util/welcome-html.lsp
@@ -0,0 +1,9 @@
+<% view = ... %>
+<h1>Alpine Configuration Framework</h1>
+<DL><p>Welcome.</p></DL>
+
+<% --[[
+ io.write(html.cfe_unpack(view))
+ io.write(html.cfe_unpack(FORM))
+ io.write(html.cfe_unpack(ENV))
+--]] %>