luci-base: dispatcher.lua: honour acl_depends annotations in Lua controllers
authorJo-Philipp Wich <jo@mein.io>
Sun, 19 Apr 2020 15:13:49 +0000 (17:13 +0200)
committerJo-Philipp Wich <jo@mein.io>
Sun, 19 Apr 2020 15:17:26 +0000 (17:17 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/luasrc/dispatcher.lua

index e13204462553b7e36a4052505b1fe17f073e3fcb..d4ba0a95e4e06bcd2c8bba3896a82b53f8ffb05f 100644 (file)
@@ -324,6 +324,14 @@ local function tree_to_json(node, json)
                                end
                        end
 
+                       if type(subnode.acl_depends) == "table" then
+                               for _, acl in ipairs(subnode.acl_depends) do
+                                       spec.depends = spec.depends or {}
+                                       spec.depends.acl = spec.depends.acl or {}
+                                       spec.depends.acl[#spec.depends.acl + 1] = acl
+                               end
+                       end
+
                        if (subnode.sysauth_authenticator ~= nil) or
                           (subnode.sysauth ~= nil and subnode.sysauth ~= false)
                        then