luci-mod-network: interfaces.js: disable action buttons on insufficient ACLs
authorJo-Philipp Wich <jo@mein.io>
Thu, 16 Apr 2020 13:21:03 +0000 (15:21 +0200)
committerJo-Philipp Wich <jo@mein.io>
Thu, 16 Apr 2020 13:21:03 +0000 (15:21 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js

index bd4ce5790184c4159b7d3abfbbfae7f4477ca241..bee57530550bf98ec50d1d7b3f8d5b6245a47543 100644 (file)
@@ -10,6 +10,8 @@
 'require firewall';
 'require tools.widgets as widgets';
 
+var isReadonlyView = !L.hasViewPermission() || null;
+
 function count_changes(section_id) {
        var changes = ui.changes.changes, n = 0;
 
@@ -281,8 +283,8 @@ return view.extend({
                                ]);
                        }
 
-                       btn1.disabled = btn1.classList.contains('spinning') || btn2.classList.contains('spinning') || dynamic;
-                       btn2.disabled = btn1.classList.contains('spinning') || btn2.classList.contains('spinning') || dynamic || disabled;
+                       btn1.disabled = isReadonlyView || btn1.classList.contains('spinning') || btn2.classList.contains('spinning') || dynamic;
+                       btn2.disabled = isReadonlyView || btn1.classList.contains('spinning') || btn2.classList.contains('spinning') || dynamic || disabled;
                }
 
                return Promise.all([ resolveZone, network.flushCache() ]);