From: Jo-Philipp Wich Date: Mon, 20 Apr 2020 07:37:45 +0000 (+0200) Subject: luci-compat: apply permission constraints from dispatcher X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=fd24221d9e99c13fa14ae4b9eaeedac6ec29d5e5;p=oweals%2Fluci.git luci-compat: apply permission constraints from dispatcher Since template scopes aren't shared we cannot pass the writable state from the map templates to the page footer. Fixes: #3937 Fixes: ffd627f2a ("luci-compat: disable legacy cbi forms on insufficient ACLs") Signed-off-by: Jo-Philipp Wich --- diff --git a/modules/luci-compat/luasrc/view/cbi/footer.htm b/modules/luci-compat/luasrc/view/cbi/footer.htm index 176f10c5e..abcc47b92 100644 --- a/modules/luci-compat/luasrc/view/cbi/footer.htm +++ b/modules/luci-compat/luasrc/view/cbi/footer.htm @@ -19,15 +19,15 @@ end if display_apply then - %> /> <% + %> /> <% end if display_save then - %> /> <% + %> /> <% end if display_reset then - %> /> <% + %> /> <% end %><% diff --git a/modules/luci-compat/luasrc/view/cbi/map.htm b/modules/luci-compat/luasrc/view/cbi/map.htm index 530d1fec6..a96f72237 100644 --- a/modules/luci-compat/luasrc/view/cbi/map.htm +++ b/modules/luci-compat/luasrc/view/cbi/map.htm @@ -2,26 +2,8 @@
<%=pcdata(msg)%>
<%- end end -%> -<% - local function has_access(config, level) - local rv = luci.util.ubus("session", "access", { - ubus_rpc_session = luci.dispatcher.context.authsession, - scope = "uci", - object = config, - ["function"] = level - }) - - return (type(rv) == "table" and rv.access == true) or false - end - - local is_readable = has_access(self.config, "read") - local is_writable = has_access(self.config, "write") - - has_writeable_map = has_writeable_map or is_writable -%> - -<% if is_readable then %> -
> +<% if readable then %> +
> <% if self.title and #self.title > 0 then %>

<%=self.title%>

<% end %>