diff --git a/agents/MeshCentralRouter.exe b/agents/MeshCentralRouter.exe index a64f1c7b..552a662c 100644 Binary files a/agents/MeshCentralRouter.exe and b/agents/MeshCentralRouter.exe differ diff --git a/meshctrl.js b/meshctrl.js index 3363903a..01328c72 100644 --- a/meshctrl.js +++ b/meshctrl.js @@ -213,7 +213,8 @@ if (args['_'].length == 0) { console.log(" MeshCtrl ListDevices"); console.log(" MeshCtrl ListDevices -id [groupid] --json"); console.log("\r\nOptional arguments:\r\n"); - console.log(" --id [groupid] - Filter by device group identifier."); + console.log(" --id [groupid] - Filter by group identifier (or --group)."); + console.log(" --group [groupname] - Filter by group name (or --id)."); console.log(" --count - Only return the device count."); console.log(" --json - Show result as JSON."); break; @@ -565,7 +566,9 @@ function serverConnect() { case 'listdevicegroups': { ws.send(JSON.stringify({ action: 'meshes' })); break; } case 'listusersofdevicegroup': { ws.send(JSON.stringify({ action: 'meshes' })); break; } case 'listdevices': { - if (args.id) { + if (args.group) { + ws.send(JSON.stringify({ action: 'nodes', meshname: args.group, responseid: 'meshctrl' })); break; + } else if (args.id) { ws.send(JSON.stringify({ action: 'nodes', meshid: args.id, responseid: 'meshctrl' })); break; } else { ws.send(JSON.stringify({ action: 'meshes' })); diff --git a/meshuser.js b/meshuser.js index 53200b2a..2d310aff 100644 --- a/meshuser.js +++ b/meshuser.js @@ -482,32 +482,46 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use case 'nodes': { var links = [], extraids = null, err = null; - try { - if (command.meshid == null) { - // Request a list of all meshes this user as rights to - links = parent.GetAllMeshIdWithRights(user); - // Add any nodes with direct rights or any nodes with user group direct rights - if (obj.user.links != null) { - for (var i in obj.user.links) { - if (i.startsWith('node/')) { if (extraids == null) { extraids = []; } extraids.push(i); } - else if (i.startsWith('ugrp/')) { - const g = parent.userGroups[i]; - if ((g != null) && (g.links != null)) { - for (var j in g.links) { if (j.startsWith('node/')) { if (extraids == null) { extraids = []; } extraids.push(j); } } + // Resolve the device group name if needed + if ((typeof command.meshname == 'string') && (command.meshid == null)) { + for (var i in parent.meshes) { + var m = parent.meshes[i]; + if ((m.mtype == 2) && (m.name == command.meshname) && parent.IsMeshViewable(user, m)) { + if (command.meshid == null) { command.meshid = m._id; } else { err = 'Duplicate device groups found'; } + } + } + if (command.meshid == null) { err = 'Invalid group id'; } + } + + if (err == null) { + try { + if (command.meshid == null) { + // Request a list of all meshes this user as rights to + links = parent.GetAllMeshIdWithRights(user); + + // Add any nodes with direct rights or any nodes with user group direct rights + if (obj.user.links != null) { + for (var i in obj.user.links) { + if (i.startsWith('node/')) { if (extraids == null) { extraids = []; } extraids.push(i); } + else if (i.startsWith('ugrp/')) { + const g = parent.userGroups[i]; + if ((g != null) && (g.links != null)) { + for (var j in g.links) { if (j.startsWith('node/')) { if (extraids == null) { extraids = []; } extraids.push(j); } } + } } } } + } else { + // Request list of all nodes for one specific meshid + meshid = command.meshid; + if (common.validateString(meshid, 0, 128) == false) { err = 'Invalid group id'; } else { + if (meshid.split('/').length == 1) { meshid = 'mesh/' + domain.id + '/' + command.meshid; } + if (parent.IsMeshViewable(user, meshid)) { links.push(meshid); } else { err = 'Invalid group id'; } + } } - } else { - // Request list of all nodes for one specific meshid - meshid = command.meshid; - if (common.validateString(meshid, 0, 128) == false) { err = 'Invalid group id'; } else { - if (meshid.split('/').length == 1) { meshid = 'mesh/' + domain.id + '/' + command.meshid; } - if (obj.IsMeshViewable(user, meshid)) { links.push(meshid); } else { err = 'Invalid group id'; } - } - } - } catch (ex) { err = 'Validation exception: ' + ex; } + } catch (ex) { err = 'Validation exception: ' + ex; } + } // Handle any errors if (err != null) { diff --git a/package.json b/package.json index f3e2cd36..db02b110 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.5.1-x", + "version": "0.5.1-y", "keywords": [ "Remote Management", "Intel AMT", diff --git a/public/images/icons16.png b/public/images/icons16.png index a1a0a1c9..20488ac0 100644 Binary files a/public/images/icons16.png and b/public/images/icons16.png differ diff --git a/public/images/icons256-8-1.png b/public/images/icons256-8-1.png new file mode 100644 index 00000000..66a80ac9 Binary files /dev/null and b/public/images/icons256-8-1.png differ diff --git a/public/images/icons50.png b/public/images/icons50.png index 9da4f723..d34f0d74 100644 Binary files a/public/images/icons50.png and b/public/images/icons50.png differ diff --git a/public/images/icons64.png b/public/images/icons64.png index 261d43ca..73077ca4 100644 Binary files a/public/images/icons64.png and b/public/images/icons64.png differ diff --git a/public/styles/style.css b/public/styles/style.css index 27f5d9ab..0fb4caf7 100644 --- a/public/styles/style.css +++ b/public/styles/style.css @@ -1194,6 +1194,14 @@ a { border: none; } +.i8 { + background: url(../images/icons50.png) -350px 0px; + height: 50px; + width: 50px; + cursor: pointer; + border: none; +} + .j1 { background: url(../images/icons16.png) 0px 0px; height: 16px; @@ -1250,6 +1258,14 @@ a { border: none; } +.j8 { + background: url(../images/icons16.png) -112px 0px; + height: 16px; + width: 16px; + cursor: pointer; + border: none; +} + .relayIcon16 { background: url(../images/icon-relay.png); height: 16px; @@ -1458,6 +1474,14 @@ a { float: left; } +.si8 { + background: url(../images/icons16.png) -112px 0px; + height: 16px; + width: 16px; + border: none; + float: left; +} + .mi { background: url(../images/meshicon50.png) 0px 0px; height: 50px; diff --git a/views/default-mobile.handlebars b/views/default-mobile.handlebars index 1b959c4b..bb8b3088 100644 --- a/views/default-mobile.handlebars +++ b/views/default-mobile.handlebars @@ -85,6 +85,13 @@ border: none; } + .i8 { + background: url(../images/icons50.png) -350px 0px; + height: 50px; + width: 50px; + border: none; + } + .m0 { background: url(../images/images16.png) -32px 0px; height: 16px; @@ -2264,7 +2271,8 @@ x += '