More agent invite code feature fixes.

This commit is contained in:
Ylian Saint-Hilaire 2020-03-17 09:40:16 -07:00
parent b1dbe69a38
commit 344ca91747
5 changed files with 526 additions and 475 deletions

View File

@ -2273,15 +2273,30 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
if ((common.validateInt(command.flags) == true) && (command.flags != mesh.flags)) { if (change != '') change += ' and flags changed'; else change += 'Group "' + mesh.name + '" flags changed'; mesh.flags = command.flags; }
if ((common.validateInt(command.consent) == true) && (command.consent != mesh.consent)) { if (change != '') change += ' and consent changed'; else change += 'Group "' + mesh.name + '" consent changed'; mesh.consent = command.consent; }
if (command.invite === '*') {
// Clear invite codes
if (mesh.invite != null) { delete mesh.invite; }
if (change != '') { change += ' and invite code changed'; } else { change += 'Group "' + mesh.name + '" invite code changed'; }
} else if (typeof command.invite === 'object') {
// Set invite codes
if ((mesh.invite == null) || (mesh.invite.codes != command.invite.codes) || (mesh.invite.flags != command.invite.flags)) {
mesh.invite = { codes: command.invite.codes, flags: command.invite.flags };
// See if we need to change device group invitation codes
if (mesh.mtype == 2) {
if (command.invite === '*') {
// Clear invite codes
if (mesh.invite != null) { delete mesh.invite; }
if (change != '') { change += ' and invite code changed'; } else { change += 'Group "' + mesh.name + '" invite code changed'; }
} else if (typeof command.invite === 'object') {
// Set invite codes
if ((mesh.invite == null) || (mesh.invite.codes != command.invite.codes) || (mesh.invite.flags != command.invite.flags)) {
// Check if an invite code is not already in use.
var dup = null;
for (var i in command.invite.codes) {
for (var j in parent.meshes) {
if ((j != command.meshid) && (parent.meshes[j].invite != null) && (parent.meshes[j].invite.codes.indexOf(command.invite.codes[i]) >= 0)) { dup = command.invite.codes[i]; break; }
}
}
if (dup != null) {
// A duplicate was found, don't allow this change.
displayNotificationMessage('Error, invite code \"' + dup + '\" already in use.', 'Invite Codes');
return;
}
mesh.invite = { codes: command.invite.codes, flags: command.invite.flags };
if (change != '') { change += ' and invite code changed'; } else { change += 'Group "' + mesh.name + '" invite code changed'; }
}
}
}

View File

@ -1,6 +1,6 @@
{
"name": "meshcentral",
"version": "0.5.0-h",
"version": "0.5.0-i",
"keywords": [
"Remote Management",
"Intel AMT",

View File

@ -47,8 +47,8 @@
"name": "Local server name",
"info": "Information about this server"
},
"_TlsOffload": true,
"_trustedproxy": true,
"_TlsOffload": "127.0.0.1",
"_TrustedProxy": "127.0.0.1",
"_MpsPort": 44330,
"_MpsAliasPort": 4433,
"_MpsAliasHost": "mps.mydomain.com",

File diff suppressed because it is too large Load Diff

View File

@ -8147,10 +8147,9 @@
x += addHtmlValue("Notifications", addLink(meshNotifyStr.join(', '), 'p20editMeshNotify()'));
// Display invitation codes
if (features & 0x01000000) {
if ((features & 0x01000000) && (currentMesh.mtype == 2)) {
var inviteCodeStr = '<i>' + "None" + '</i>', icodes = false;
if (currentMesh.invite != null) { icodes = true; inviteCodeStr = currentMesh.invite.codes.join(', '); /* + ', ' + currentMesh.invite.flags;*/ }
//x += addHtmlValue("Invite Codes", addLink(inviteCodeStr, 'p20editmeshInviteCode()'));
x += addHtmlValue("Invite Codes", addLinkConditional(inviteCodeStr, 'p20editmeshInviteCode()', (meshrights & 1) || (icodes)));
}