diff --git a/meshuser.js b/meshuser.js index 42fcbfb1..0b9ac6a4 100644 --- a/meshuser.js +++ b/meshuser.js @@ -1926,8 +1926,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use else if (common.validateString(command.meshname, 1, 128) == false) { err = 'Invalid group name'; } // Meshname is between 1 and 128 characters else if ((command.desc != null) && (common.validateString(command.desc, 0, 1024) == false)) { err = 'Invalid group description'; } // Mesh description is between 0 and 1024 characters else if ((command.meshtype < 1) || (command.meshtype > 4)) { err = 'Invalid group type'; } // Device group types are 1 = AMT, 2 = Agent, 3 = Local - else if ((command.meshtype == 3) && (parent.args.wanonly == true) && (typeof command.relayid != 'string')) { err = 'Invalid group type'; } // Local device group type wihtout relay is not allowed in WAN mode - else if ((command.meshtype == 3) && (parent.args.lanonly == true) && (typeof command.relayid == 'string')) { err = 'Invalid group type'; } // Local device group type with relay is not allowed in WAN mode + else if (((command.meshtype == 3) || (command.meshtype == 4)) && (parent.args.wanonly == true) && (typeof command.relayid != 'string')) { err = 'Invalid group type'; } // Local device group type wihtout relay is not allowed in WAN mode + else if (((command.meshtype == 3) || (command.meshtype == 4)) && (parent.args.lanonly == true) && (typeof command.relayid == 'string')) { err = 'Invalid group type'; } // Local device group type with relay is not allowed in WAN mode else if ((domain.ipkvm == null) && (command.meshtype == 4)) { err = 'Invalid group type'; } // IP KVM device group type is not allowed unless enabled if ((err == null) && (command.meshtype == 4)) { if ((command.kvmmodel < 1) || (command.kvmmodel > 2)) { err = 'Invalid KVM model'; } @@ -1961,7 +1961,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (command.meshtype == 4) { mesh.kvm = { model: command.kvmmodel, host: command.kvmhost, user: command.kvmuser, pass: command.kvmpass }; } // If this is device group that requires a relay device, store that now - if ((parent.args.lanonly != true) && (command.meshtype == 3) && (typeof command.relayid == 'string')) { + if ((parent.args.lanonly != true) && ((command.meshtype == 3) || (command.meshtype == 4)) && (typeof command.relayid == 'string')) { // Check the relay id var relayIdSplit = command.relayid.split('/'); if ((relayIdSplit[0] == 'node') && (relayIdSplit[1] == domain.id)) { mesh.relayid = command.relayid; } @@ -2155,7 +2155,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if ((common.validateInt(command.expireDevs, 0, 2000) == true) && (command.expireDevs != mesh.expireDevs)) { if (change != '') change += ' and auto-remove changed'; else change += 'Device group "' + mesh.name + '" auto-remove changed'; changesids.push(5); if (command.expireDevs == 0) { delete mesh.expireDevs; } else { mesh.expireDevs = command.expireDevs; } } var oldRelayNodeId = null, newRelayNodeId = null; - if ((typeof command.relayid == 'string') && (mesh.mtype == 3) && (mesh.relayid != null) && (command.relayid != mesh.relayid)) { + if ((typeof command.relayid == 'string') && ((mesh.mtype == 3) || (mesh.mtype == 4)) && (mesh.relayid != null) && (command.relayid != mesh.relayid)) { var relayIdSplit = command.relayid.split('/'); if ((relayIdSplit.length == 3) && (relayIdSplit[0] = 'node') && (relayIdSplit[1] == domain.id)) { if (change != '') { change += ' and device relay changed'; } else { change = 'Device relay changed'; } diff --git a/views/default-mobile.handlebars b/views/default-mobile.handlebars index 18d6080f..d616db48 100644 --- a/views/default-mobile.handlebars +++ b/views/default-mobile.handlebars @@ -6045,7 +6045,7 @@ if (currentMesh.mtype == 1) meshtype = "Intel® AMT only, no agent"; if (currentMesh.mtype == 2) meshtype = "Managed using a software agent"; if (currentMesh.mtype == 3) { if (currentMesh.relayid == null) { meshtype = "Local devices, no agent"; } else { meshtype = "No agent devices relayed thru agent"; } } - if (currentMesh.mtype == 4) { meshtype = "IP-KVM device"; if (currentMesh.kvm.model == 1) { meshtype += ', ' + 'Raritan KX III'; } } + if (currentMesh.mtype == 4) { if (currentMesh.relayid == null) { meshtype = "IP-KVM device"; } else { meshtype = "IP-KVM device relayed thru agent"; } if (currentMesh.kvm.model == 1) { meshtype += ', ' + 'Raritan KX III'; } } var x = ''; x += addHtmlValue("Name", addLinkConditional(EscapeHtml(currentMesh.name), 'p20editmesh(1)', (meshrights & 1) != 0)); @@ -6054,7 +6054,7 @@ //x += addHtmlValue('Identifier', currentMesh._id.split('/')[2]); // Display the relay device if applicable - if ((currentMesh.mtype == 3) && (currentMesh.relayid != null)) { + if (((currentMesh.mtype == 3) || (currentMesh.mtype == 4)) && (currentMesh.relayid != null)) { var relayName = '' + "Unknown" + ''; var relayNode = getNodeFromId(currentMesh.relayid); if (relayNode != null) { relayName = EscapeHtml(relayNode.name); } diff --git a/views/default.handlebars b/views/default.handlebars index a78f5394..ccfd6096 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -11591,8 +11591,11 @@ var x = "Create a new device group using the options below." + '

', localGroupType = ''; x += addHtmlValue("Name", ''); if ((features & 1) == 0) { localGroupType += ''; } - if (((features & 2) == 0) && (relayDevices.length > 0)) { localGroupType += ''; } - if (features2 & 0x10000) { localGroupType += ''; } + if (((features & 2) == 0) && (relayDevices.length > 0)) { localGroupType += ''; } + if (features2 & 0x10000) { + if ((features & 1) == 0) { localGroupType += ''; } + if (((features & 2) == 0) && (relayDevices.length > 0)) { localGroupType += ''; } + } x += addHtmlValue("Type", '
'); if (relayDevices.length > 0) { x += '