diff --git a/meshcentral.js b/meshcentral.js index fe4feffe..a1376235 100644 --- a/meshcentral.js +++ b/meshcentral.js @@ -2458,13 +2458,7 @@ function mainStart() { if (require('os').platform() == 'win32') { modules.push('node-windows'); if (sspi == true) { modules.push('node-sspi'); } } // Add Windows modules if (ldap == true) { modules.push('ldapauth-fork'); } if (recordingIndex == true) { modules.push('image-size'); } // Need to get the remote desktop JPEG sizes to index the recodring file. - if (config.letsencrypt != null) { - if (config.letsencrypt.lib == 'greenlock') { - if ((nodeVersion < 10) || (require('crypto').generateKeyPair == null)) { addServerWarning("Let's Encrypt support requires Node v10.12 or higher.", !args.launch); } else { modules.push('greenlock@4.0.4'); } - } else { - if (nodeVersion < 8) { addServerWarning("Let's Encrypt support requires Node v8.x or higher.", !args.launch); } else { modules.push('acme-client'); } - } - } // Add Greenlock Module or acme-client module + if (config.letsencrypt != null) { if (nodeVersion < 8) { addServerWarning("Let's Encrypt support requires Node v8.x or higher.", !args.launch); } else { modules.push('acme-client'); } } // Add acme-client module if (config.settings.mqtt != null) { modules.push('aedes'); } // Add MQTT Modules if (config.settings.mysql != null) { modules.push('mysql'); } // Add MySQL, official driver. if (config.settings.mongodb != null) { modules.push('mongodb'); } // Add MongoDB, official driver. diff --git a/meshuser.js b/meshuser.js index 0abc8cd3..83e5e615 100644 --- a/meshuser.js +++ b/meshuser.js @@ -3081,7 +3081,12 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if ((typeof command.icon == 'number') && (command.icon != node.icon)) { change = 1; node.icon = command.icon; changes.push('icon'); } if ((typeof command.name == 'string') && (command.name != node.name)) { change = 1; node.name = command.name; changes.push('name'); } if ((typeof command.host == 'string') && (command.host != node.host)) { change = 1; node.host = command.host; changes.push('host'); } - if (typeof command.consent == 'number') { if (((command.consent != 0) && ((node.consent == null) || (node.consent == 0))) || ((command.consent == 0) && (node.consent != null) && (node.consent != 0))) { change = 1; if (command.consent == 0) { delete node.consent; } else { node.consent = command.consent; } changes.push('consent'); } } + if (typeof command.consent == 'number') { + var oldConsent = node.consent; + if (command.consent != node.consent) { node.consent = command.consent; } + if (command.consent == 0) { delete node.consent; } + if (oldConsent != node.consent) { change = 1; changes.push('consent'); } + } if ((typeof command.rdpport == 'number') && (command.rdpport > 0) && (command.rdpport < 65536)) { if ((command.rdpport == 3389) && (node.rdpport != null)) { diff --git a/package.json b/package.json index 3d8ab5f2..d2f99428 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.5.1-v", + "version": "0.5.1-w", "keywords": [ "Remote Management", "Intel AMT", diff --git a/translate/translate.json b/translate/translate.json index cf980154..4822aadd 100644 --- a/translate/translate.json +++ b/translate/translate.json @@ -3924,7 +3924,12 @@ }, { "en": "Ask Consent", - "en": "Vraag toestemming", + "xloc": [ + "default.handlebars->deskConnectContextMenu->cxdeskuc->0" + ] + }, + { + "en": "Ask Consent + Bar", "xloc": [ "default.handlebars->deskConnectContextMenu->cxdeskuc->0" ] @@ -8207,7 +8212,7 @@ "en": "Devices", "nl": "Apparaten", "xloc": [ - "default.handlebars->29->1441", + "default.handlebars->29->1443", "default.handlebars->29->1465" ] }, @@ -8793,18 +8798,7 @@ ] }, { - "cs": "Duplikovat agenta", - "de": "Agent-Duplikat", - "en": "Duplicate agent", - "es": "Agente duplicado", - "fr": "Cloner l'agent", - "hi": "डुप्लीकेट एजेंट", - "ja": "重複エージェント", - "ko": "중복 에이전트", - "nl": "Duplicaat Agent", - "pt": "Agente duplicado", - "ru": "Скопировать агент", - "zh-chs": "代理重複", + "en": "Duplicate Agent", "xloc": [ "default.handlebars->29->1623" ] @@ -8843,6 +8837,20 @@ "default.handlebars->29->1457" ] }, + { + "cs": "Duplikovat agenta", + "de": "Agent-Duplikat", + "en": "Duplicate agent", + "es": "Agente duplicado", + "fr": "Cloner l'agent", + "hi": "डुप्लीकेट एजेंट", + "ja": "重複エージェント", + "ko": "중복 에이전트", + "nl": "Duplicaat Agent", + "pt": "Agente duplicado", + "ru": "Скопировать агент", + "zh-chs": "代理重複" + }, { "cs": "Délka trvání", "de": "Dauer", @@ -26413,7 +26421,7 @@ "ru": "Пользователи", "zh-chs": "用戶數", "xloc": [ - "default.handlebars->29->1443", + "default.handlebars->29->1441", "default.handlebars->29->1463", "default.handlebars->29->1642", "default.handlebars->container->topbar->1->1->UsersSubMenuSpan->UsersSubMenu->1->0->UsersGeneral" @@ -26710,6 +26718,9 @@ "default.handlebars->29->1028" ] }, + { + "en": "Vraag toestemming" + }, { "cs": "VAROVÁNÍ: ", "de": "WARNUNG: ", @@ -29515,4 +29526,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/views/default.handlebars b/views/default.handlebars index cdc1155f..1945d818 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -70,6 +70,7 @@
Login Shell

'; - } else if (userid === 1) { + } else if (userid == 1) { var y = ''; if (selected == null) { - for (var i in meshes) { if ((currentUser.links == null) || (currentUser.links[i] == null)) { y += ''; } } + var omeshs = getOrderedList(meshes, 'name'); + for (var i in omeshs) { if ((currentUser.links == null) || (currentUser.links[omeshs[i]._id] == null)) { y += ''; } } } else { y += ''; } x += addHtmlValue("Device Group", '
'); - } else if (userid === 2) { + } else if (userid == 2) { if (usergroups == null) return; var y = ''; - for (var i in usergroups) { if ((currentMesh.links == null) || (currentMesh.links[i] == null)) { y += ''; } } + var ousergroups = getOrderedList(usergroups, 'name'); + for (var i in ousergroups) { if ((currentMesh.links == null) || (currentMesh.links[ousergroups[i]._id] == null)) { y += ''; } } x += addHtmlValue("User Group", '
'); - } else if (userid === 6) { + } else if (userid == 6) { if (usergroups == null) return; var y = ''; if (selected == null) { - for (var i in usergroups) { if ((currentNode.links == null) || (currentNode.links[i] == null)) { y += ''; } } + var ousergroups = getOrderedList(usergroups, 'name'); + for (var i in ousergroups) { if ((currentNode.links == null) || (currentNode.links[ousergroups[i]._id] == null)) { y += ''; } } } else { y += ''; } x += addHtmlValue("User Group", '
'); - } else if (userid === 3) { + } else if (userid == 3) { var y = ''; if (selected) { selected = decodeURIComponent(selected); } - for (var i in meshes) { if ((selected != null) || (currentUserGroup.links == null) || (currentUserGroup.links[i] == null)) { y += ''; } } - x += addHtmlValue("Device Group", '
'); - } else if ((userid === 4) || (userid == 7)) { + var omeshs = getOrderedList(meshes, 'name'); + for (var i in omeshs) { if ((selected != null) || (currentUserGroup.links == null) || (currentUserGroup.links[i] == null)) { y += ''; } } + x += addHtmlValue("Device Group", '
'); + } else if ((userid == 4) || (userid == 7)) { var y = '', selectedMeshId = null, selectedNode = null; if (selected != null) { selectedNode = getNodeFromId(decodeURIComponent(selected)); if (selectedNode != null) { selectedMeshId = selectedNode.meshid; } } - for (var i in meshes) { - if ((meshes[i].links[userinfo._id] != null) && (meshes[i].links[userinfo._id].rights & 7)) { // Only show device groups that we have user administrator for. - if (selectedMeshId == null) { selectedMeshId = meshes[i]._id; } y += ''; + var omeshs = getOrderedList(meshes, 'name'); + for (var i in omeshs) { + if ((omeshs[i].links[userinfo._id] != null) && (omeshs[i].links[userinfo._id].rights & 7)) { // Only show device groups that we have user administrator for. + if (selectedMeshId == null) { selectedMeshId = omeshs[i]._id; } y += ''; } } x += addHtmlValue("Device Group", '
'); y = ''; - for (var i in nodes) { if (nodes[i].meshid == selectedMeshId) { y += ''; } } + var onodes = getOrderedList(nodes, 'name'); + for (var i in onodes) { if (onodes[i].meshid == selectedMeshId) { y += ''; } } x += addHtmlValue("Device", '
'); } else { userid = decodeURIComponent(userid); @@ -8726,11 +8736,11 @@ return false; } - function p20changeMeshAddMeshUserDialog() { + function p20changeMeshAddMeshUserDialog(userid) { var y = '', meshid = decodeURIComponent(Q('dp2meshid').value); for (var i in nodes) { if (nodes[i].meshid == meshid) { y += ''; } } QH('dp2nodeid', y); - p20validateAddMeshUserDialog(4); + p20validateAddMeshUserDialog(userid); } function p20setname(name) { @@ -8749,6 +8759,7 @@ if (updateId === 4) { // Update user device rights var devrights = 0, nodeid = decodeURIComponent(Q('dp2nodeid').value); + console.log('nodeid', nodeid); if ((nodeid != '') && (currentUser.links != null) && (currentUser.links[nodeid] != null)) { devrights = currentUser.links[nodeid].rights; } Q('p20remotecontrol').checked = ((devrights & 8) != 0); Q('p20meshagentconsole').checked = ((devrights & 16) != 0); @@ -10103,7 +10114,7 @@ } else { // Display the groups using the sorted list x += ''; - x += '
' + "Name" + '' + "Devices" + '' + "Device Groups" + '' + "Users"; + x += '' + "Name" + '' + "Users" + '' + "Device Groups" + '' + "Devices"; for (var i in sortedGroups) { x += addUserGroupHtml(sortedGroups[i]); } x += '
'; QV('DuplicateUserGroupButton', true); @@ -10127,7 +10138,7 @@ x += '
'; x += '
'; x += '
'; - x += '
' + group.name + '
' + devicecount + '' + meshcount + '' + usercount; + x += '
' + group.name + '
' + usercount + '' + meshcount + '' + devicecount; return x; } @@ -10282,19 +10293,19 @@ if ((deviceGroupCount > 0) && (newDeviceGroup)) { x += ' ' + "Add Device Group" + ''; } x += ''; if (currentUserGroup.links) { - for (var i in currentUserGroup.links) { - if (i.startsWith('mesh/')) { - var cr = 0, r = currentUserGroup.links[i].rights, mesh = meshes[i], trash = '', rights = makeDeviceGroupRightsString(r); - if (mesh == null) { continue; } - if ((userinfo.links) && (userinfo.links[i] != null) && (userinfo.links[i].rights != null)) { cr = userinfo.links[i].rights; } - var meshname = '' + "Unknown Device Group" + ''; - if (mesh) { meshname = '' + mesh.name + ''; } else {} - if ((cr & 2) != 0) { - trash = ''; - rights = '
' + rights + '
'; - } - x += ''; + var omeshes = []; + for (var i in currentUserGroup.links) { if (i.startsWith('mesh/')) { if (meshes[i] != null) { omeshes.push(meshes[i]); } } } + omeshes = getOrderedList(omeshes, 'name'); + for (var i in omeshes) { + var cr = 0, mesh = omeshes[i], r = currentUserGroup.links[mesh._id].rights, trash = '', rights = makeDeviceGroupRightsString(r); + if ((userinfo.links) && (userinfo.links[i] != null) && (userinfo.links[i].rights != null)) { cr = userinfo.links[i].rights; } + var meshname = '' + "Unknown Device Group" + ''; + if (mesh) { meshname = '' + mesh.name + ''; } else {} + if ((cr & 2) != 0) { + trash = ''; + rights = '' + rights + ' '; } + x += ''; } } if (count == 1) { x += ''; } @@ -10305,18 +10316,18 @@ x += '
' + "Add Device" + ''; x += '
' + "Common Device Groups" + '
 ' + meshname + '
' + trash + '
' + rights + '
 ' + meshname + '
' + trash + '
' + rights + '
 ' + "No device groups in common" + '
'; if (currentUserGroup.links) { - for (var i in currentUserGroup.links) { - if (i.startsWith('node/')) { - var r = currentUserGroup.links[i].rights, node = getNodeFromId(i), trash = '', rights = makeUserDeviceRightsString(r), cr = GetNodeRights(node); - if (node == null) { continue; } - var nodename = '' + "Unknown Device" + ''; - if (node) { nodename = '' + node.name + ''; } else {} - if ((cr & 2) != 0) { - trash = ''; - rights = '
' + rights + '
'; - } - x += ''; + var onodes = []; + for (var i in currentUserGroup.links) { if (i.startsWith('node/')) { var node = getNodeFromId(i); if (node != null) { onodes.push(node); } } } + onodes = getOrderedList(onodes, 'name'); + for (var i in onodes) { + var node = onodes[i], r = currentUserGroup.links[node._id].rights, trash = '', rights = makeUserDeviceRightsString(r), cr = GetNodeRights(node); + var nodename = '' + "Unknown Device" + ''; + if (node) { nodename = '' + node.name + ''; } else {} + if ((cr & 2) != 0) { + trash = ''; + rights = '' + rights + ' '; } + x += ''; } } if (count == 1) { x += ''; } @@ -10690,25 +10701,25 @@ var count = 1, x = ''; // Display common device groups - count = 1; var deviceGroupCount = 0, newDeviceGroup = false; for (var i in meshes) { deviceGroupCount++; if ((currentUser.links == null) || (currentUser.links[i] == null)) { newDeviceGroup = true; } } if ((deviceGroupCount > 0) && (newDeviceGroup)) { x += ' ' + "Add Device Group" + ''; } x += '
' + "Common Devices" + '
 ' + nodename + '
' + trash + '
' + rights + '
 ' + nodename + '
' + trash + '
' + rights + '
 ' + "No devices in common" + '
'; if (currentUser.links) { - for (var i in currentUser.links) { - if (i.startsWith('mesh/')) { - var cr = 0, r = currentUser.links[i].rights, mesh = meshes[i], trash = '', rights = makeDeviceGroupRightsString(r); - if (mesh == null) { continue; } - if ((userinfo.links) && (userinfo.links[i] != null) && (userinfo.links[i].rights != null)) { cr = userinfo.links[i].rights; } - var meshname = '' + "Unknown Device Group" + ''; - if (mesh) { meshname = '' + EscapeHtml(mesh.name) + ''; } else {} - if ((currentUser._id != userinfo._id) && ((cr & 2) != 0)) { - rights = '
' + rights + '
'; - trash = ''; - } - x += ''; + var omeshes = []; + for (var i in currentUser.links) { if (i.startsWith('mesh/')) { if (meshes[i] != null) { omeshes.push(meshes[i]); } } } + omeshes = getOrderedList(omeshes, 'name'); + for (var i in omeshes) { + var cr = 0, mesh = omeshes[i], r = currentUser.links[mesh._id].rights, trash = '', rights = makeDeviceGroupRightsString(r); + if (mesh == null) { continue; } + if ((userinfo.links) && (userinfo.links[i] != null) && (userinfo.links[i].rights != null)) { cr = userinfo.links[i].rights; } + var meshname = '' + "Unknown Device Group" + ''; + if (mesh) { meshname = '' + EscapeHtml(mesh.name) + ''; } else {} + if ((currentUser._id != userinfo._id) && ((cr & 2) != 0)) { + trash = ''; + rights = '' + rights + ' '; } + x += ''; } } if (count == 1) { x += ''; } @@ -10725,17 +10736,18 @@ } x += '
' + "Common Device Groups" + '
 ' + meshname + '
' + trash + '
' + rights + '
 ' + meshname + '
' + trash + '
' + rights + '
 ' + "No device groups in common" + '
'; if (currentUser.links) { - for (var i in currentUser.links) { - if (i.startsWith('ugrp/')) { - var r = currentUser.links[i].rights, group = usergroups[i], trash = ''; - var groupname = '' + "Unknown User Group" + ''; - if (group != null) { - groupname = EscapeHtml(group.name); - if (usergroups != null) { groupname = '' + groupname + ''; } - } - if ((userinfo.siteadmin & 256) != 0) { trash = ''; } - x += ''; + var ougroups = []; + for (var i in currentUser.links) { if (i.startsWith('ugrp/')) { if (usergroups[i] != null) { ougroups.push(usergroups[i]); } } } + ougroups = getOrderedList(ougroups, 'name'); + for (var i in ougroups) { + var group = usergroups[i], r = currentUser.links[ougroups[i]._id].rights, trash = ''; + var groupname = '' + "Unknown User Group" + ''; + if (group != null) { + groupname = EscapeHtml(group.name); + if (usergroups != null) { groupname = '' + groupname + ''; } } + if ((userinfo.siteadmin & 256) != 0) { trash = ''; } + x += ''; } } if (count == 1) { x += ''; } @@ -10743,6 +10755,7 @@ } // Display common devices + count = 1; x += '
' + "Add Device" + ''; x += '
' + "User Group Memberships" + '
 ' + groupname + '
' + trash + '
 ' + groupname + '
' + trash + '
 ' + "No user group memberships" + '
'; if (currentUser.links) { @@ -10755,8 +10768,8 @@ if ((userinfo.links) && (userinfo.links[i] != null) && (userinfo.links[i].rights != null)) { cr = userinfo.links[i].rights; } var nodename = node?EscapeHtml(node.name):('' + "Unknown Device" + ''); if ((cr & 2) != 0) { - rights = '
' + makeUserDeviceRightsString(r) + '
'; trash = ''; + rights = '' + makeUserDeviceRightsString(r) + ' '; } nodename = '' + nodename + ''; x += ''; @@ -11960,6 +11973,7 @@ function addDetailItem(title, value, state) { return '
' + "Common Devices" + '
 ' + nodename + '
' + trash + '
' + rights + '
' + nobreak(title) + '' + value + '
'; } function format(format) { var args = Array.prototype.slice.call(arguments, 1); return format.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] != 'undefined' ? args[number] : match; }); }; function addTextLink(subtext, text, link) { var i = text.toLowerCase().indexOf(subtext.toLowerCase()); if (i == -1) { return text; } return text.substring(0, i) + '' + subtext + '' + text.substring(i + subtext.length); } + function getOrderedList(objList, oname) { var r = []; for (var i in objList) { r.push(objList[i]); } r.sort(function(a, b) { var aa = a[oname].toLowerCase(), bb = b[oname].toLowerCase(); if (aa > bb) return 1; if (aa < bb) return -1; return 0; }); return r; } function nobreak(x) { return x.split(' ').join(' '); }