luci-mod-status: assoclist: hide wifi disconnect on insufficient ACLs
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
dc57e4bc6c
commit
17770e49eb
1 changed files with 13 additions and 3 deletions
|
@ -2,6 +2,14 @@
|
||||||
'require baseclass';
|
'require baseclass';
|
||||||
'require dom';
|
'require dom';
|
||||||
'require network';
|
'require network';
|
||||||
|
'require rpc';
|
||||||
|
|
||||||
|
var callSessionAccess = rpc.declare({
|
||||||
|
object: 'session',
|
||||||
|
method: 'access',
|
||||||
|
params: [ 'scope', 'object', 'function' ],
|
||||||
|
expect: { 'access': false }
|
||||||
|
});
|
||||||
|
|
||||||
function renderbox(radio, networks) {
|
function renderbox(radio, networks) {
|
||||||
var chan = null,
|
var chan = null,
|
||||||
|
@ -91,7 +99,8 @@ return baseclass.extend({
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
network.getWifiDevices(),
|
network.getWifiDevices(),
|
||||||
network.getWifiNetworks(),
|
network.getWifiNetworks(),
|
||||||
network.getHostHints()
|
network.getHostHints(),
|
||||||
|
callSessionAccess('access-group', 'luci-mod-status-index-wifi', 'write')
|
||||||
]).then(function(radios_networks_hints) {
|
]).then(function(radios_networks_hints) {
|
||||||
var tasks = [];
|
var tasks = [];
|
||||||
|
|
||||||
|
@ -110,7 +119,8 @@ return baseclass.extend({
|
||||||
var seen = {},
|
var seen = {},
|
||||||
radios = data[0],
|
radios = data[0],
|
||||||
networks = data[1],
|
networks = data[1],
|
||||||
hosthints = data[2];
|
hosthints = data[2],
|
||||||
|
hasWritePermission = data[3];
|
||||||
|
|
||||||
var table = E('div', { 'class': 'network-status-table' });
|
var table = E('div', { 'class': 'network-status-table' });
|
||||||
|
|
||||||
|
@ -209,7 +219,7 @@ return baseclass.extend({
|
||||||
])
|
])
|
||||||
];
|
];
|
||||||
|
|
||||||
if (networks[i].isClientDisconnectSupported()) {
|
if (networks[i].isClientDisconnectSupported() && hasWritePermission) {
|
||||||
if (assoclist.firstElementChild.childNodes.length < 6)
|
if (assoclist.firstElementChild.childNodes.length < 6)
|
||||||
assoclist.firstElementChild.appendChild(E('div', { 'class': 'th cbi-section-actions' }));
|
assoclist.firstElementChild.appendChild(E('div', { 'class': 'th cbi-section-actions' }));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue