Merge pull request #3158 from dibdot/banIP
[oweals/luci.git] / modules / luci-base / luasrc / dispatcher.lua
index 626a46dfd28b674db96e899b027e800ea4ad284e..f571144566fffb9e689cb53a6a4dd7398a0c3997 100644 (file)
@@ -149,7 +149,11 @@ function httpdispatch(request, prefix)
        --context._disable_memtrace()
 end
 
-local function require_post_security(target)
+local function require_post_security(target, args)
+       if type(target) == "table" and target.type == "arcombine" and type(target.targets) == "table" then
+               return require_post_security((type(args) == "table" and #args > 0) and target.targets[2] or target.targets[1], args)
+       end
+
        if type(target) == "table" then
                if type(target.post) == "table" then
                        local param_name, required_val, request_val
@@ -470,7 +474,7 @@ function dispatch(request)
                return
        end
 
-       if c and require_post_security(c.target) then
+       if c and require_post_security(c.target, args) then
                if not test_post_security(c) then
                        return
                end
@@ -857,6 +861,15 @@ function template(name)
 end
 
 
+local _view = function(self, ...)
+       require "luci.template".render("view", { view = self.view })
+end
+
+function view(name)
+       return {type = "view", view = name, target = _view}
+end
+
+
 local function _cbi(self, ...)
        local cbi = require "luci.cbi"
        local tpl = require "luci.template"