summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-04-24 22:45:29 +0200
committerGitHub <noreply@github.com>2020-04-24 22:45:29 +0200
commit8f67311c26d24efe893a7d908967dd806cb711c9 (patch)
tree560bdcd5ca1b957aec6ca3170063c661249e56fd
parent083f8f748b509f855b2be248431434355f5ef121 (diff)
parent6037c8a847962a52ceb48f3c8059c60300949bc8 (diff)
Merge pull request #3962 from janh/vnstat2-acl
luci-app-vnstat2: fix ACL rules, disable button on insufficient ACLs
-rw-r--r--applications/luci-app-vnstat2/htdocs/luci-static/resources/view/vnstat2/config.js5
-rw-r--r--applications/luci-app-vnstat2/root/usr/share/rpcd/acl.d/luci-app-vnstat2.json3
2 files changed, 6 insertions, 2 deletions
diff --git a/applications/luci-app-vnstat2/htdocs/luci-static/resources/view/vnstat2/config.js b/applications/luci-app-vnstat2/htdocs/luci-static/resources/view/vnstat2/config.js
index 14e968a07..46781442a 100644
--- a/applications/luci-app-vnstat2/htdocs/luci-static/resources/view/vnstat2/config.js
+++ b/applications/luci-app-vnstat2/htdocs/luci-static/resources/view/vnstat2/config.js
@@ -8,6 +8,8 @@
'require form';
'require tools.widgets as widgets';
+var isReadonlyView = !L.hasViewPermission() || null;
+
return view.extend({
handleDeleteModal: function(m, iface, ev) {
L.showModal(_('Delete interface <em>%h</em>').format(iface), [
@@ -88,7 +90,8 @@ return view.extend({
this.interfaces[i],
E('button', {
'class': 'btn cbi-button-remove',
- 'click': ui.createHandlerFn(view, 'handleDeleteModal', m, this.interfaces[i])
+ 'click': ui.createHandlerFn(view, 'handleDeleteModal', m, this.interfaces[i]),
+ 'disabled': isReadonlyView
}, [ _('Deleteā€¦') ])
]);
}
diff --git a/applications/luci-app-vnstat2/root/usr/share/rpcd/acl.d/luci-app-vnstat2.json b/applications/luci-app-vnstat2/root/usr/share/rpcd/acl.d/luci-app-vnstat2.json
index fb16f09c9..7acf74bd5 100644
--- a/applications/luci-app-vnstat2/root/usr/share/rpcd/acl.d/luci-app-vnstat2.json
+++ b/applications/luci-app-vnstat2/root/usr/share/rpcd/acl.d/luci-app-vnstat2.json
@@ -6,7 +6,8 @@
"file": {
"/usr/bin/vnstat --json f 1": [ "exec" ],
"/usr/bin/vnstati -[5dhmsty] -i * -o -": [ "exec" ]
- }
+ },
+ "uci": [ "vnstat" ]
},
"write": {
"file": {