diff --git a/meshuser.js b/meshuser.js index a67324ed..a5b7197f 100644 --- a/meshuser.js +++ b/meshuser.js @@ -317,6 +317,14 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use // Remove Intel AMT credential if present if (docs[i].intelamt != null && docs[i].intelamt.pass != null) { delete docs[i].intelamt.pass; } + // If GeoLocation not enabled, remove any node location information + if (domain.geolocation != true) { + if (docs[i].iploc != null) { delete docs[i].iploc; } + if (docs[i].wifiloc != null) { delete docs[i].wifiloc; } + if (docs[i].gpsloc != null) { delete docs[i].gpsloc; } + if (docs[i].userloc != null) { delete docs[i].userloc; } + } + r[meshid].push(docs[i]); } try { ws.send(JSON.stringify({ action: 'nodes', nodes: r, tag: command.tag })); } catch (ex) { } @@ -1482,7 +1490,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (command.icon && (command.icon != node.icon)) { change = 1; node.icon = command.icon; changes.push('icon'); } if (command.name && (command.name != node.name)) { change = 1; node.name = command.name; changes.push('name'); } if (command.host && (command.host != node.host)) { change = 1; node.host = command.host; changes.push('host'); } - if (command.userloc && ((node.userloc == null) || (command.userloc[0] != node.userloc[0]) || (command.userloc[1] != node.userloc[1]))) { + if (domain.geolocation && command.userloc && ((node.userloc == null) || (command.userloc[0] != node.userloc[0]) || (command.userloc[1] != node.userloc[1]))) { change = 1; if ((command.userloc.length == 0) && (node.userloc)) { delete node.userloc; diff --git a/package.json b/package.json index d3dcfe4c..d8c3bfbe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.2.9-d", + "version": "0.2.9-e", "keywords": [ "Remote Management", "Intel AMT", diff --git a/sample-config.json b/sample-config.json index f247c4d3..55b21d57 100644 --- a/sample-config.json +++ b/sample-config.json @@ -50,6 +50,7 @@ "_CertUrl": "https://192.168.2.106:443/", "_PasswordRequirements": { "min": 8, "max": 128, "upper": 1, "lower": 1, "numeric": 1, "nonalpha": 1 }, "_AgentNoProxy": true, + "_GeoLocation": true, "_UserAllowedIP": "127.0.0.1,192.168.1.0/24", "_UserBlockedIP": "127.0.0.1,::1,192.168.0.100", "_AgentAllowedIP": "192.168.0.100/24", diff --git a/views/default.handlebars b/views/default.handlebars index 89482b1f..a1b79a10 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -2866,6 +2866,7 @@ // Load the entire map function loadmap() { if (xxmap == null) return; + if ((features & 0x8000) == 0) { QV('viewselectmapoption', false); QV('devViewButton4', false); xxmap = null; return; } // Geolocation not supported try { // Initialize a Source Vector xxmap.markersSource = new ol.source.Vector(); @@ -3547,7 +3548,6 @@ x += '
'; if (mesh.mtype == 2) x += 'Interfaces '; if (xxmap != null) x += 'Location '; - if (((meshrights & 8) != 0) && (mesh.mtype == 2)) x += 'Router '; // RDP link, show this link only of the remote machine is Windows. diff --git a/webserver.js b/webserver.js index 72b5f2a0..738c7607 100644 --- a/webserver.js +++ b/webserver.js @@ -999,6 +999,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { if ((domain.auth != 'sspi') && (obj.parent.certificates.CommonName != 'un-configured') && (obj.args.nousers !== true)) { features += 0x1000; } // 2-step login supported if (domain.agentnoproxy === true) { features += 0x2000; } // Indicates that agents should be installed without using a HTTP proxy if (domain.yubikey && domain.yubikey.id && domain.yubikey.secret) { features += 0x4000; } // Indicates Yubikey support + if (domain.geolocation == true) { features += 0x8000; } // Enable geo-location features // Create a authentication cookie const authCookie = obj.parent.encodeCookie({ userid: user._id, domainid: domain.id }, obj.parent.loginCookieEncryptionKey);