mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-02-04 18:35:58 -05:00
MeshCtrl can now create device groups with features/consent options.
This commit is contained in:
parent
ac772f6f4b
commit
aaa3b0f857
11
meshctrl.js
11
meshctrl.js
@ -458,11 +458,20 @@ if (args['_'].length == 0) {
|
||||
console.log("Add a device group, Example usages:\r\n");
|
||||
console.log(" MeshCtrl AddDeviceGroup --name newgroupname");
|
||||
console.log(" MeshCtrl AddDeviceGroup --name newgroupname --desc description --amtonly");
|
||||
console.log(" MeshCtrl AddDeviceGroup --name newgroupname --features 1 --consent 7");
|
||||
console.log("\r\nRequired arguments:\r\n");
|
||||
console.log(" --name [name] - Name of the new group.");
|
||||
console.log("\r\nOptional arguments:\r\n");
|
||||
console.log(" --desc [description] - New group description.");
|
||||
console.log(" --amtonly - New group is agent-less, Intel AMT only.");
|
||||
console.log(" --features [number] - Set device group features, sum of numbers below.");
|
||||
console.log(" 1 = Auto-Remove 2 = Hostname Sync");
|
||||
console.log(" 4 = Record Sessions");
|
||||
console.log(" --consent [number] - Set device group user consent, sum of numbers below.");
|
||||
console.log(" 1 = Desktop notify user 2 = Terminal notify user ");
|
||||
console.log(" 4 = Files notify user 8 = Desktop prompt user ");
|
||||
console.log(" 16 = Terminal prompt user 32 = Files prompt user ");
|
||||
console.log(" 64 = Desktop Toolbar ");
|
||||
break;
|
||||
}
|
||||
case 'removedevicegroup': {
|
||||
@ -1094,6 +1103,8 @@ function serverConnect() {
|
||||
var op = { action: 'createmesh', meshname: args.name, meshtype: 2, responseid: 'meshctrl' };
|
||||
if (args.desc) { op.desc = args.desc; }
|
||||
if (args.amtonly) { op.meshtype = 1; }
|
||||
if (args.features) { op.flags = parseInt(args.features); }
|
||||
if (args.consent) { op.consent = parseInt(args.consent); }
|
||||
ws.send(JSON.stringify(op));
|
||||
break;
|
||||
}
|
||||
|
@ -2705,6 +2705,12 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
var links = {};
|
||||
links[user._id] = { name: user.name, rights: 4294967295 };
|
||||
mesh = { type: 'mesh', _id: meshid, name: command.meshname, mtype: command.meshtype, desc: command.desc, domain: domain.id, links: links, creation: Date.now(), creatorid: user._id, creatorname: user.name };
|
||||
|
||||
// Add flags and consent if present
|
||||
if (typeof command.flags == 'number') { mesh.flags = command.flags; }
|
||||
if (typeof command.consent == 'number') { mesh.consent = command.consent; }
|
||||
|
||||
// Save the new device group
|
||||
db.Set(mesh);
|
||||
parent.meshes[meshid] = mesh;
|
||||
parent.parent.AddEventDispatch([meshid], ws);
|
||||
@ -2723,7 +2729,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
parent.parent.DispatchEvent(targets, obj, event);
|
||||
|
||||
// Event the device group creation
|
||||
var event = { etype: 'mesh', userid: user._id, username: user.name, meshid: meshid, name: command.meshname, mtype: command.meshtype, desc: command.desc, action: 'createmesh', links: links, msgid: 76, msgArgs: [command.meshname], msg: 'Device group created: ' + command.meshname, domain: domain.id, creation: mesh.creation, creatorid: mesh.creatorid, creatorname: mesh.creatorname };
|
||||
var event = { etype: 'mesh', userid: user._id, username: user.name, meshid: meshid, name: command.meshname, mtype: command.meshtype, desc: command.desc, action: 'createmesh', links: links, msgid: 76, msgArgs: [command.meshname], msg: 'Device group created: ' + command.meshname, domain: domain.id, creation: mesh.creation, creatorid: mesh.creatorid, creatorname: mesh.creatorname, flags: mesh.flags, consent: mesh.consent };
|
||||
parent.parent.DispatchEvent(['*', meshid, user._id], obj, event); // Even if DB change stream is active, this event must be acted upon.
|
||||
|
||||
// Log in the auth log
|
||||
|
@ -2631,7 +2631,7 @@
|
||||
case 'createmesh': {
|
||||
// A new mesh was created
|
||||
if ((meshes[message.event.meshid] == null) && ((serverinfo.manageAllDeviceGroups) || (message.event.links[userinfo._id] != null))) { // Check if this is a mesh create for a mesh we own. If site administrator, we get all messages so need to ignore some.
|
||||
meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links, creation: message.event.creation, creatorid: message.event.creatorid, creatorname: message.event.creatorname };
|
||||
meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links, creation: message.event.creation, creatorid: message.event.creatorid, creatorname: message.event.creatorname, flags: message.event.flags, consent: message.event.consent };
|
||||
mainUpdate(4 + 128 + 8192 + 16384);
|
||||
meshserver.send({ action: 'files' });
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user