If you could do that that would be great, you seem to have much more experience using git then I do. I basically just threw this together for proof of concept, I think if could be improved a lot before actually being implemented into Luci. Also, just this past weekend I decided to make some changes to try and simplify things. The new method has far fewer moving parts and is much less invasive to the luci src. Basically I got rid of most of the modifications to the dispatcher.lua and the need for renaming.I did this by adding simple checks to determine if the user has privileges to use each index entry in the index() function of each controller.
\-- Copyright 2008 Steven Barth <steven@midlink.org>
-- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
-- Licensed to the public under the Apache License 2.0.
module("luci.controller.admin.status", package.seeall)
function index()
local fs = require "nixio.fs"
function user(val)
if not fs.access("/usr/lib/lua/luci/users.lua") then return true end
local dsp = require "luci.dispatcher"
local usw = require "luci.users"
local user = dsp.get_user()
if user == "root" then return true end
local name = "status"
local menu = {}
menu = usw.hide_menus(user,name) or {}
for i,v in pairs(menu) do
if v == val then return true end
end
return false
end
entry({"admin", "status"}, alias("admin", "status", "overview"), _("Status"), 20).index = true
entry({"admin", "status", "overview"}, template("admin_status/index"), _("Overview"), 1)
if user("Firewall") == true then
entry({"admin", "status", "iptables"}, call("action_iptables"), _("Firewall"), 2).leaf = true
end
if user("Routes") == true then
entry({"admin", "status", "routes"}, template("admin_status/routes"), _("Routes"), 3)
end
if user("System_log") == true then
entry({"admin", "status", "syslog"}, call("action_syslog"), _("System Log"), 4)
end
if user("Kernel_log") == true then
entry({"admin", "status", "dmesg"}, call("action_dmesg"), _("Kernel Log"), 5)
end
if user("Processes") == true then
entry({"admin", "status", "processes"}, cbi("admin_status/processes"), _("Processes"), 6)
end
if user("Realtime_graphs") == true then
entry({"admin", "status", "realtime"}, alias("admin", "status", "realtime", "load"), _("Realtime Graphs"), 7)
entry({"admin", "status", "realtime", "load"}, template("admin_status/load"), _("Load"), 1).leaf = true
entry({"admin", "status", "realtime", "load_status"}, call("action_load")).leaf = true
entry({"admin", "status", "realtime", "bandwidth"}, template("admin_status/bandwidth"), _("Traffic"), 2).leaf = true
entry({"admin", "status", "realtime", "bandwidth_status"}, call("action_bandwidth")).leaf = true
entry({"admin", "status", "realtime", "wireless"}, template("admin_status/wireless"), _("Wireless"), 3).leaf = true
entry({"admin", "status", "realtime", "wireless_status"}, call("action_wireless")).leaf = true
entry({"admin", "status", "realtime", "connections"}, template("admin_status/connections"), _("Connections"), 4).leaf = true
entry({"admin", "status", "realtime", "connections_status"}, call("action_connections")).leaf = true
entry({"admin", "status", "nameinfo"}, call("action_nameinfo")).leaf = true
end
end
It is functional and working great though I am still finishing the up a couple last things, I hope to have it completed today, once I finish you can do a diff on it, I think it should merge much nicer then the original version.