summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Mason <ms13sp@gmail.com>2008-02-26 21:28:47 +0000
committerMike Mason <ms13sp@gmail.com>2008-02-26 21:28:47 +0000
commit54afa6997c702c0652743bfee0ac16fa5a865c8b (patch)
tree0534e1d826dfd78f54ae26b4265cec36078a3f29
parentb628ff48516bf4f1c779bde03ae65a9cbcb4e690 (diff)
downloadacf-core-54afa6997c702c0652743bfee0ac16fa5a865c8b.tar.bz2
acf-core-54afa6997c702c0652743bfee0ac16fa5a865c8b.tar.xz
Logic is there and writes to the mainmenu table. Will still need to work out bugs and get these menus to go away. Tomorrow...
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@770 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r--app/acf_www-controller.lua63
-rw-r--r--roles2
2 files changed, 37 insertions, 28 deletions
diff --git a/app/acf_www-controller.lua b/app/acf_www-controller.lua
index 9463934..5170175 100644
--- a/app/acf_www-controller.lua
+++ b/app/acf_www-controller.lua
@@ -23,36 +23,45 @@ local function build_menus(self)
sessiondata.menu = {}
sessiondata.menu.mainmenu = m.get_menuitems(self.conf.appdir)
sessiondata.menu.submenu = m.get_submenuitems(self.conf.appdir)
--- if sessiondata.userinfo == nil then
- --we are dealing with un unknown user
--- p = {"ALL"}
+ if sessiondata.userinfo == nil then
+ --we are dealing with an unknown user
+ p = {"ALL"}
+ --this will be whatever the "UNKNOWN" role is ... right now it is ALL
--temp should be the
--- local temp = format.string_to_table(roll.get_roles_perm(self,p),",")
+ local temp = format.string_to_table(roll.get_roles_perm(self,p),",")
--lets apply permissions
--- for a,b in pairs(sessiondata.menu.mainmenu) do
--- for k,v in pairs(temp) do
-
--- local control,acti = string.match(v,"(%a+):(%a+)")
--- if sessiondata.menu.mainmenu[a].controller == control then
--- test action
---
--- sessiondata.menu.mainmenu[a].action ~= acti then
--- sessiondata.menu.mainmenu[a] = nil
--- end
-
--- end
--- end
- -- else
+
+
+ for a,b in pairs(sessiondata.menu.mainmenu) do
+
+ for k,v in pairs(temp) do
+ local control,acti = string.match(v,"(%a+):(%a+)")
+
+ if sessiondata.menu.mainmenu[a].controller == control then
+ --test action
+ if sessiondata.menu.mainmenu[a].action == acti then
+ sessiondata.menu.mainmenu[a].match = "yes"
+ else
+-- sessiondata.menu.mainmenu[a] = nil
+ sessiondata.menu.mainmenu[a].match = "no"
+ end
+ else
+ sessiondata.menu.mainmenu[a].match = "no"
+ end
+
+ end
+ end
+ else
--we don't need to figure out what permission have it is in sessiondata
--- local temp = format.string_to_table(sessiondata.userinfo.perm,",")
--- for e,f in pairs(temp) do
--- local control,acti = string.match(f,"(%a+):(%a+)")
--- if sessiondata.menu.mainmenu[a].controller ~= control and sessiondata.menu.mainmenu[a].action ~= acti then
--- sessiondata.menu.mainmenu[a] = nil
--- end
--- end
-
- -- end
+ local temp = format.string_to_table(sessiondata.userinfo.perm,",")
+ for e,f in pairs(temp) do
+ local control,acti = string.match(f,"(%a+):(%a+)")
+ if sessiondata.menu.mainmenu[a].controller ~= control and sessiondata.menu.mainmenu[a].action ~= acti then
+ sessiondata.menu.mainmenu[a] = nil
+ end
+ end
+
+ end
-- Debug: Timestamp on menu creation
sessiondata.menu.timestamp = {tab="Menu_created: " .. os.date(),action="Menu_created: " .. os.date(),}
end
diff --git a/roles b/roles
index 537e147..c65ebb7 100644
--- a/roles
+++ b/roles
@@ -2,4 +2,4 @@ CREATE=syslog:config,syslog:status
READ=skins:read,alpineversion:read,interfaces:read,logfiles:status
UPDATE=skins:update,syslog:expert
DELETE=interfaces:delete,logfiles:delete
-ALL=welcome:read
+ALL=welcome:read,interfaces:read,health:system,skins:read