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
commit01169cf4a2076de6db14e055b7569722a99b07ea (patch)
tree8491233bd1c91731ee6bacba7a0a75208d5bb4c5
parent0219cbf27f77936e86e80cb9a090e0944ec16825 (diff)
downloadacf-tcpproxy-01169cf4a2076de6db14e055b7569722a99b07ea.tar.bz2
acf-tcpproxy-01169cf4a2076de6db14e055b7569722a99b07ea.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/tcpproxy/trunk@1563 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r--tcpproxy-listsmtpentries-html.lsp4
-rw-r--r--tcpproxy-listsmtpfiles-html.lsp6
-rw-r--r--tcpproxy-model.lua2
-rw-r--r--tcpproxy.roles8
4 files changed, 14 insertions, 6 deletions
diff --git a/tcpproxy-listsmtpentries-html.lsp b/tcpproxy-listsmtpentries-html.lsp
index fb8e761..87809a9 100644
--- a/tcpproxy-listsmtpentries-html.lsp
+++ b/tcpproxy-listsmtpentries-html.lsp
@@ -16,8 +16,12 @@ require("viewfunctions")
<% for i,interface in ipairs(view.value) do %>
<TR>
<TD style="padding-right:20px;white-space:nowrap;">
+ <% if session.permissions.tcpproxy.editsmtpentry then %>
<%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/editsmtpentry?ipaddr="..(interface.ipaddr or interface.interface).."&redir="..page_info.orig_action, label="Edit "} %>
+ <% end %>
+ <% if session.permissions.tcpproxy.delsmtpentry then %>
<%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/delsmtpentry?ipaddr="..(interface.ipaddr or interface.interface), label="Delete "} %>
+ <% end %>
</TD>
<TD style="padding-right:20px;white-space:nowrap;"><%= interface.interface or "" %></TD>
<TD style="padding-right:20px;white-space:nowrap;"><%= interface.ipaddr or "" %></TD>
diff --git a/tcpproxy-listsmtpfiles-html.lsp b/tcpproxy-listsmtpfiles-html.lsp
index 6b067e8..5de93ba 100644
--- a/tcpproxy-listsmtpfiles-html.lsp
+++ b/tcpproxy-listsmtpfiles-html.lsp
@@ -15,8 +15,12 @@ require("viewfunctions")
<% for i,file in ipairs(view.value) do %>
<TR>
<TD style="padding-right:20px;white-space:nowrap;">
+ <% if session.permissions.tcpproxy.editsmtpfile then %>
<%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/editsmtpfile?filename="..file.."&redir="..page_info.orig_action, label="Edit "} %>
+ <% end %>
+ <% if session.permissions.tcpproxy.delsmtpfile then %>
<%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/delsmtpfile?filename="..file, label="Delete "} %>
+ <% end %>
</TD>
<TD style="white-space:nowrap;"><%= file %></TD>
</TR>
@@ -24,7 +28,7 @@ require("viewfunctions")
</TABLE>
</DL>
-<% if viewlibrary and viewlibrary.dispatch_component then
+<% if viewlibrary and viewlibrary.dispatch_component and session.permissions.tcpproxy.createsmtpfile then
local createform = viewlibrary.dispatch_component("createsmtpfile", nil, true) %>
<H2><%= createform.label %></H2>
<%
diff --git a/tcpproxy-model.lua b/tcpproxy-model.lua
index 508301f..d5e8a12 100644
--- a/tcpproxy-model.lua
+++ b/tcpproxy-model.lua
@@ -206,7 +206,7 @@ end
function getsmtpstatus()
local value, errtxt = processinfo.package_version(smtppackagename)
- local version = cfe({ value=value, label="Program version" })
+ local version = cfe({ value=value, label="Program version", errtxt=errtxt })
return cfe({ type="group", value={version=version, entries=entries}, label="SMTP Proxy Status" })
end
diff --git a/tcpproxy.roles b/tcpproxy.roles
index 803e033..76e4ad9 100644
--- a/tcpproxy.roles
+++ b/tcpproxy.roles
@@ -1,4 +1,4 @@
-READ=tcpproxy:status,tcpproxy:smtpstatus,tcpproxy:listsmtpentries,tcpproxy:listsmtpfiles
-UPDATE=tcpproxy:startstop,tcpproxy:expert,tcpproxy:editsmtpentry,tcpproxy:editsmtpfile
-DELETE=tcpproxy:delsmtpentry,tcpproxy:delsmtpfile
-CREATE=tcpproxy:createsmtpfile
+USER=tcpproxy:status,tcpproxy:smtpstatus,tcpproxy:listsmtpentries,tcpproxy:listsmtpfiles,tcpproxy:startstop
+EDITOR=tcpproxy:editsmtpentry,tcpproxy:editsmtpfile,tcpproxy:delsmtpentry,tcpproxy:delsmtpfile,tcpproxy:createsmtpfile
+EXPERT=tcpproxy:expert
+ADMIN=tcpproxy:status,tcpproxy:smtpstatus,tcpproxy:listsmtpentries,tcpproxy:listsmtpfiles,tcpproxy:startstop,tcpproxy:editsmtpentry,tcpproxy:editsmtpfile,tcpproxy:delsmtpentry,tcpproxy:delsmtpfile,tcpproxy:createsmtpfile,tcpproxy:expert