luci-mod-status: hide DHCP and assoclist on insufficient ACLs
authorJo-Philipp Wich <jo@mein.io>
Sat, 18 Apr 2020 17:58:35 +0000 (19:58 +0200)
committerJo-Philipp Wich <jo@mein.io>
Sat, 18 Apr 2020 21:25:22 +0000 (23:25 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/40_dhcp.js
modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/60_wifi.js

index f839a180c72c5851465e5e66d523b25ff0761fba..603c0d93aa066a28c48299351afa680b2b17e829 100644 (file)
@@ -14,7 +14,7 @@ return baseclass.extend({
 
        load: function() {
                return Promise.all([
-                       L.resolveDefault(callLuciDHCPLeases(), {}),
+                       callLuciDHCPLeases(),
                        network.getHostHints()
                ]);
        },
index 1e3aeb2426fe12627f8d0f2b429fcc21c77a3117..deb6f8609f681867c7602d000e7269f919de4ba1 100644 (file)
@@ -100,6 +100,7 @@ return baseclass.extend({
                        network.getWifiDevices(),
                        network.getWifiNetworks(),
                        network.getHostHints(),
+                       callSessionAccess('access-group', 'luci-mod-status-index-wifi', 'read'),
                        callSessionAccess('access-group', 'luci-mod-status-index-wifi', 'write')
                ]).then(function(radios_networks_hints) {
                        var tasks = [];
@@ -120,7 +121,8 @@ return baseclass.extend({
                    radios = data[0],
                    networks = data[1],
                    hosthints = data[2],
-                   hasWritePermission = data[3];
+                   hasReadPermission = data[3],
+                   hasWritePermission = data[4];
 
                var table = E('div', { 'class': 'network-status-table' });
 
@@ -240,8 +242,8 @@ return baseclass.extend({
 
                return E([
                        table,
-                       E('h3', _('Associated Stations')),
-                       assoclist
+                       hasReadPermission ? E('h3', _('Associated Stations')) : E([]),
+                       hasReadPermission ? assoclist : E([])
                ]);
        }
 });