diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-04-16 15:38:56 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-04-16 15:38:56 +0200 |
commit | e822382a98dfce0cfd729737ca068594266625a9 (patch) | |
tree | a3a277bf3ed8d18cc28fddcf9df7dbd9fdb13eb3 /modules/luci-mod-system/htdocs/luci-static/resources | |
parent | 74e8fb0c8edccdc34263748809c9500766af622c (diff) |
luci-mod-system: startup.js: disable action buttons on insufficient ACLs
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-system/htdocs/luci-static/resources')
-rw-r--r-- | modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js index 146a991df..ae92ce88b 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/startup.js @@ -4,6 +4,8 @@ 'require fs'; 'require ui'; +var isReadonlyView = !L.hasViewPermission() || null; + return view.extend({ callInitList: rpc.declare({ object: 'luci', @@ -59,7 +61,8 @@ return view.extend({ renderEnableDisable: function(init) { return E('button', { class: 'btn cbi-button-%s'.format(init.enabled ? 'positive' : 'negative'), - click: ui.createHandlerFn(this, 'handleEnableDisable', init.name, init.enabled) + click: ui.createHandlerFn(this, 'handleEnableDisable', init.name, init.enabled), + disabled: isReadonlyView }, init.enabled ? _('Enabled') : _('Disabled')); }, @@ -93,9 +96,9 @@ return view.extend({ list[i].name, E('div', [ this.renderEnableDisable(list[i]), - E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleAction', list[i].name, 'start') }, _('Start')), - E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleAction', list[i].name, 'restart') }, _('Restart')), - E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleAction', list[i].name, 'stop') }, _('Stop')) + E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleAction', list[i].name, 'start'), 'disabled': isReadonlyView }, _('Start')), + E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleAction', list[i].name, 'restart'), 'disabled': isReadonlyView }, _('Restart')), + E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleAction', list[i].name, 'stop'), 'disabled': isReadonlyView }, _('Stop')) ]) ]); } @@ -111,11 +114,12 @@ return view.extend({ ]), E('div', { 'data-tab': 'rc', 'data-tab-title': _('Local Startup') }, [ E('p', {}, _('This is the content of /etc/rc.local. Insert your own commands here (in front of \'exit 0\') to execute them at the end of the boot process.')), - E('p', {}, E('textarea', { 'style': 'width:100%', 'rows': 20 }, [ (rcLocal != null ? rcLocal : '') ])), + E('p', {}, E('textarea', { 'style': 'width:100%', 'rows': 20, 'disabled': isReadonlyView }, [ (rcLocal != null ? rcLocal : '') ])), E('div', { 'class': 'cbi-page-actions' }, [ E('button', { 'class': 'btn cbi-button-save', - 'click': ui.createHandlerFn(this, 'handleRcLocalSave') + 'click': ui.createHandlerFn(this, 'handleRcLocalSave'), + 'disabled': isReadonlyView }, _('Save')) ]) ]) |