From 27ad66831e066f6c69cb62845b7c97bfe1672043 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Mon, 30 Mar 2020 13:29:06 -0700 Subject: [PATCH] More device rights fixes. --- translate/translate.json | 12 +++++------- views/default-mobile.handlebars | 18 ++++++++++-------- views/default.handlebars | 13 +++++++------ 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/translate/translate.json b/translate/translate.json index ed2490a7..42eba51a 100644 --- a/translate/translate.json +++ b/translate/translate.json @@ -217,10 +217,7 @@ "nl": " Gebruiker toevoegen", "pt": " Adicionar usuário", "ru": " Добавить пользователя", - "zh-chs": " 添加用戶", - "xloc": [ - "default-mobile.handlebars->9->284" - ] + "zh-chs": " 添加用戶" }, { "cs": " Je možné zadat i nápovědu pro heslo, ale nedoporučuje se to.", @@ -2423,6 +2420,7 @@ "ru": "Добавить пользователя", "zh-chs": "添加用戶", "xloc": [ + "default-mobile.handlebars->9->284", "default.handlebars->27->531" ] }, @@ -24822,8 +24820,8 @@ ] }, { - "en": "User Permissions" - "en": "Gebruikersrechten" + "en": "User Permissions", + "nl": "Gebruikersrechten" }, { "cs": "PowerShell uživatele", @@ -27786,4 +27784,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/views/default-mobile.handlebars b/views/default-mobile.handlebars index efa20d3d..8ca0f385 100644 --- a/views/default-mobile.handlebars +++ b/views/default-mobile.handlebars @@ -797,7 +797,7 @@ for (var n in message.nodes[m]) { message.nodes[m][n].namel = message.nodes[m][n].name.toLowerCase(); if (message.nodes[m][n].rname) { message.nodes[m][n].rnamel = message.nodes[m][n].rname.toLowerCase(); } else { message.nodes[m][n].rnamel = message.nodes[m][n].namel; } - if (meshes[m]) { message.nodes[m][n].meshnamel = meshes[m].name.toLowerCase(); } + message.nodes[m][n].meshnamel = meshes[m]?meshes[m].name.toLowerCase():'*'; message.nodes[m][n].meshid = m; message.nodes[m][n].state = (message.nodes[m][n].state) ? (message.nodes[m][n].state) : 0; message.nodes[m][n].desc = message.nodes[m][n].desc; @@ -1029,7 +1029,7 @@ if (getNodeFromId(node._id) != null) break; // This node is already known. node.namel = node.name.toLowerCase(); if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; } - node.meshnamel = meshes[node.meshid].name.toLowerCase(); + node.meshnamel = meshes[node.meshid]?meshes[node.meshid].name.toLowerCase():'*'; node.state = 0; if (!node.icon) node.icon = 1; node.ident = ++nodeShortIdent; @@ -1121,7 +1121,7 @@ } else { // We see the new mesh, move this device node.meshid = message.event.newMeshId; - node.meshnamel = meshes[message.event.newMeshId].name.toLowerCase(); + node.meshnamel = meshes[message.event.newMeshId]?meshes[message.event.newMeshId].name.toLowerCase():'*'; } updateDevices(); refreshDevice(message.event.nodeid); @@ -1131,7 +1131,7 @@ if (!meshes[node.meshid]) break; // This is a node for a mesh we don't know. Happens when we are site administrator, we get all messages. node.namel = node.name.toLowerCase(); if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; } - node.meshnamel = meshes[node.meshid].name.toLowerCase(); + node.meshnamel = meshes[node.meshid]?meshes[node.meshid].name.toLowerCase():'*'; node.state = 0; if (!node.icon) node.icon = 1; node.ident = ++nodeShortIdent; @@ -1751,7 +1751,8 @@ if (sort == 0) { // Mesh header nodes.sort(meshSort); - if (nodes[i].meshid != current) { + //if (nodes[i].meshid != current) { + if (((meshes[nodes[i].meshid]?nodes[i].meshid:'*') != current)) { deviceHeaderSet(); var extra = ''; if ((meshes[nodes[i].meshid] != null) && (meshes[nodes[i].meshid].mtype == 1)) { extra = '' + ", Intel® AMT only" + ''; } @@ -1761,11 +1762,12 @@ if (meshes[nodes[i].meshid]) { r += '' + EscapeHtml(meshes[nodes[i].meshid].name) + '' + extra + ''; + current = nodes[i].meshid; } else { - r += '' + "Indivitual Devices" + '' + extra + ''; + r += '' + "Indivitual Devices" + '' + extra + ''; + current = '*'; } - current = nodes[i].meshid; displayedMeshes[current] = 1; c = 0; } @@ -3196,7 +3198,7 @@ x += '

'; var currentMeshLinks = currentMesh.links[userinfo._id]; - if (currentMeshLinks && ((currentMeshLinks.rights & 2) != 0)) { x += '
' + " Add User" + '
'; } + if (currentMeshLinks && ((currentMeshLinks.rights & 2) != 0)) { x += '
' + "Add User" + '
'; } /* if ((meshrights & 4) != 0) { diff --git a/views/default.handlebars b/views/default.handlebars index c4953023..b958d0fa 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -1818,7 +1818,7 @@ if (message.nodes[m][n]._id == null) { console.log('Invalid node (' + n + '): ' + JSON.stringify(message.nodes)); continue; } message.nodes[m][n].namel = message.nodes[m][n].name.toLowerCase(); if (message.nodes[m][n].rname) { message.nodes[m][n].rnamel = message.nodes[m][n].rname.toLowerCase(); } else { message.nodes[m][n].rnamel = message.nodes[m][n].namel; } - if (meshes[m]) { message.nodes[m][n].meshnamel = meshes[m].name.toLowerCase(); } + message.nodes[m][n].meshnamel = meshes[m]?meshes[m].name.toLowerCase():'*'; message.nodes[m][n].meshid = m; message.nodes[m][n].state = (message.nodes[m][n].state)?(message.nodes[m][n].state):0; if (!message.nodes[m][n].icon) message.nodes[m][n].icon = 1; @@ -2377,7 +2377,7 @@ if (getNodeFromId(node._id) != null) break; // This node is already known. node.namel = node.name.toLowerCase(); if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; } - node.meshnamel = meshes[node.meshid].name.toLowerCase(); + node.meshnamel = meshes[node.meshid]?meshes[node.meshid].name.toLowerCase():'*'; node.state = 0; if (!node.icon) node.icon = 1; node.ident = ++nodeShortIdent; @@ -2475,7 +2475,7 @@ } else { // We see the new mesh, move this device node.meshid = message.event.newMeshId; - node.meshnamel = meshes[message.event.newMeshId].name.toLowerCase(); + node.meshnamel = meshes[message.event.newMeshId]?meshes[message.event.newMeshId].name.toLowerCase():'*'; masterUpdate(1 | 2 | 4); } refreshDevice(message.event.nodeid); @@ -2485,7 +2485,7 @@ if (!meshes[node.meshid]) break; // This is a node for a mesh we don't know. Happens when we are site administrator, we get all messages. node.namel = node.name.toLowerCase(); if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; } - node.meshnamel = meshes[node.meshid].name.toLowerCase(); + node.meshnamel = meshes[node.meshid]?meshes[node.meshid].name.toLowerCase():'*'; node.state = 0; if (!node.icon) node.icon = 1; node.ident = ++nodeShortIdent; @@ -2975,7 +2975,7 @@ var meshrights = GetNodeRights(node); if (sort == 0) { // Mesh header - if (node.meshid != current) { + if (((meshes[node.meshid]?node.meshid:'*') != current)) { if (((view == 1) || (view == 3)) && (current != null)) { r += ''; } // Close collapse div deviceHeaderSet(); var extra = ''; @@ -2992,11 +2992,12 @@ } if (meshes[node.meshid]) { r += '' + EscapeHtml(meshes[node.meshid].name) + '' + getMeshActions(mesh2, meshrights) + ''; + current = node.meshid; } else { r += '' + "Indivitual Devices" + ''; + current = '*'; } if (view == 2) { r += ''; } - current = node.meshid; displayedMeshes[current] = 1; c = 0; if ((view == 1) || (view == 3)) { r += '
'; } // Open collapse div