Added user consent option on desktop connect button.
This commit is contained in:
parent
d71271f89d
commit
3f666107d0
|
@ -795,7 +795,7 @@ function createMeshCore(agent) {
|
|||
if (process.platform != 'win32') break;
|
||||
var p = require('user-sessions').enumerateUsers();
|
||||
p.sessionid = data.sessionid;
|
||||
p.then(function (u) { mesh.SendCommand({ action: 'msg', type: 'userSessions', sessionid: data.sessionid, data: u }); });
|
||||
p.then(function (u) { mesh.SendCommand({ action: 'msg', type: 'userSessions', sessionid: data.sessionid, data: u, tag: data.tag }); });
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -1804,6 +1804,10 @@ function createMeshCore(agent) {
|
|||
//sendConsoleText('options: ' + JSON.stringify(obj));
|
||||
delete obj.type;
|
||||
ws.httprequest.xoptions = obj;
|
||||
|
||||
// Set additional user consent options if present
|
||||
if ((obj != null) && (typeof obj.consent == 'number')) { ws.httprequest.consent += obj.consent; }
|
||||
|
||||
break;
|
||||
}
|
||||
case 'close': {
|
||||
|
|
|
@ -3482,7 +3482,7 @@
|
|||
// Check device group link permission
|
||||
var rights = 0, r = mesh.links[userid];
|
||||
if (r != null) {
|
||||
if (rights == 0xFFFFFFFF) { return 0xFFFFFFFF; } // User has full rights thru a device group link, stop here.
|
||||
if (r.rights == 0xFFFFFFFF) { return 0xFFFFFFFF; } // User has full rights thru a device group link, stop here.
|
||||
rights = r.rights;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<div id="cxtermps" class="cmtext" onclick="cmtermaction(8,event)">User Shell</div>
|
||||
<div id="cxtermps" class="cmtext" onclick="cmtermaction(100,event)">Login Shell</div>
|
||||
</div>
|
||||
<div id="deskConnectContextMenu" class="contextMenu noselect" style="display:none;min-width:0px">
|
||||
<div id="cxdeskuc" class="cmtext" onclick="cmdeskaction(1,event)"><b>Ask Consent</b></div>
|
||||
</div>
|
||||
<div id="altPortContextMenu" class="contextMenu noselect" style="display:none;min-width:0px">
|
||||
<div id="cxaltport" class="cmtext" onclick="cmaltportaction(1,event)"><b>Alternate Port</b></div>
|
||||
</div>
|
||||
|
@ -511,7 +514,7 @@
|
|||
<div>
|
||||
<div id="idx_deskFullBtn2" onclick=deskToggleFull(event)> ✖</div>
|
||||
<input type="button" id="autoconnectbutton1" value="AutoConnect" onclick=autoConnectDesktop(event) onkeypress="return false" onkeydown="return false" style="display:none" />
|
||||
<span id=connectbutton1span><input type=button id=connectbutton1 value="Connect" onclick=connectDesktop(event,3) onkeypress="return false" onkeydown="return false" disabled="disabled" /></span>
|
||||
<span id=connectbutton1span><input type=button id=connectbutton1 cmenu="deskConnectButton" value="Connect" onclick=connectDesktop(event,3) onkeypress="return false" onkeydown="return false" disabled="disabled" /></span>
|
||||
<span id=connectbutton1hspan> <input type=button id=connectbutton1h value="HW Connect" title="Connect using Intel AMT hardware KVM" onclick=connectDesktop(event,2) onkeypress="return false" onkeydown="return false" disabled="disabled" /></span>
|
||||
<span id=disconnectbutton1span> <input type=button id=disconnectbutton1 value="Disconnect" onclick=connectDesktop(event,0) onkeypress="return false" onkeydown="return false" /></span>
|
||||
<span id="deskstatus">Disconnected</span>
|
||||
|
@ -1902,12 +1905,12 @@
|
|||
// Got list of user sessions
|
||||
var userSessions = [];
|
||||
if (message.data != null) { for (var i in message.data) { if ((message.data[i].State == 'Active') || (message.data[i].StationName == 'Console') || (debugmode == 3)) { userSessions.push(message.data[i]); } } }
|
||||
if (userSessions.length == 0) { connectDesktop(null, 1); } // No active sessions, do a normal connection.
|
||||
else if (userSessions.length == 1) { connectDesktop(null, 1, userSessions[0].SessionId); } // One active session, connect to it
|
||||
if (userSessions.length == 0) { connectDesktop(null, 1, null, message.tag); } // No active sessions, do a normal connection.
|
||||
else if (userSessions.length == 1) { connectDesktop(null, 1, userSessions[0].SessionId, message.tag); } // One active session, connect to it
|
||||
else {
|
||||
var x = '';
|
||||
for (var i in userSessions) {
|
||||
x += '<div style="text-align:left;cursor:pointer;background-color:gray;margin:5px;padding:5px;border-radius:5px" onclick=connectDesktop(event,1,' + userSessions[i].SessionId + ')>' + userSessions[i].State + ', ' + userSessions[i].StationName;
|
||||
x += '<div style="text-align:left;cursor:pointer;background-color:gray;margin:5px;padding:5px;border-radius:5px" onclick=connectDesktop(event,1,' + userSessions[i].SessionId + ',' + message.tag + ')>' + userSessions[i].State + ', ' + userSessions[i].StationName;
|
||||
if (userSessions[i].Username) { if (userSessions[i].Domain) { x += ' - ' + userSessions[i].Domain + '/' + userSessions[i].Username; } else { x += ' - ' + userSessions[i].Username; } }
|
||||
x += '</div>';
|
||||
}
|
||||
|
@ -4004,6 +4007,13 @@
|
|||
showContextMenuDiv(contextmenudiv, event.pageX, event.pageY);
|
||||
break;
|
||||
}
|
||||
case 'deskConnectButton': {
|
||||
// Desktop connect button context menu
|
||||
if ((currentNode == null) || (currentNode.agent == null)) return true;
|
||||
contextelement = elem;
|
||||
showContextMenuDiv(document.getElementById('deskConnectContextMenu'), event.pageX, event.pageY);
|
||||
break;
|
||||
}
|
||||
case 'devsContentMenu': {
|
||||
// Device content menu
|
||||
contextelement = elem;
|
||||
|
@ -4094,6 +4104,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
function cmdeskaction(action) {
|
||||
if (action == 1) { connectDesktop(null, 3, null, 0x0008); } // Do remote desktop connection using consent prompt
|
||||
}
|
||||
|
||||
function cmaltportaction(action) {
|
||||
if (xxdialogMode) return;
|
||||
var x = "RDP remote connection port:" + '<br /><br /><input type=text placeholder="3389" inputmode="numeric" pattern="[0-9]*" onkeypress=\"return (event.keyCode == 8) || (event.charCode >= 48 && event.charCode <= 57)\" maxlength=5 id=d10rdpport type=text>';
|
||||
|
@ -4147,6 +4161,7 @@
|
|||
QV('meshContextMenu', false);
|
||||
QV('termShellContextMenu', false);
|
||||
QV('termShellContextMenuLinux', false);
|
||||
QV('deskConnectContextMenu', false);
|
||||
QV('altPortContextMenu', false);
|
||||
QV('filesContextMenu', false);
|
||||
//QV('pluginTabContextMenu', false);
|
||||
|
@ -5748,7 +5763,7 @@
|
|||
var autoConnectDesktopTimer = null;
|
||||
function autoConnectDesktop(e) { if (autoConnectDesktopTimer == null) { autoConnectDesktopTimer = setInterval(function() { connectDesktop(null, 1) }, 1000); } else { clearInterval(autoConnectDesktopTimer); autoConnectDesktopTimer = null; } }
|
||||
|
||||
function connectDesktop(e, contype, tsid) {
|
||||
function connectDesktop(e, contype, tsid, consent) {
|
||||
if (xxdialogMode) return;
|
||||
if ((e != null) && (e.shiftKey != false) && (contype == 3)) { contype = 1; } // If the shift key is not pressed, don't try to ask for session list.
|
||||
QV('p11DeskSessionSelector', false);
|
||||
|
@ -5845,7 +5860,9 @@
|
|||
desktop.debugmode = debugmode;
|
||||
desktop.m.debugmode = debugmode;
|
||||
desktop.attemptWebRTC = attemptWebRTC;
|
||||
if (tsid != null) { desktop.options = { tsid: tsid }; }
|
||||
desktop.options = {};
|
||||
if (tsid != null) { desktop.options.tsid = tsid; }
|
||||
if (consent != null) { desktop.options.consent = consent; }
|
||||
desktop.onStateChanged = onDesktopStateChange;
|
||||
desktop.onConsoleMessageChange = function () {
|
||||
p11clearConsoleMsg();
|
||||
|
@ -5865,7 +5882,7 @@
|
|||
desktop.contype = 1;
|
||||
} else if (contype == 3) {
|
||||
// Ask for user sessions
|
||||
meshserver.send({ action: 'msg', type: 'userSessions', nodeid: currentNode._id });
|
||||
meshserver.send({ action: 'msg', type: 'userSessions', nodeid: currentNode._id, tag: consent });
|
||||
}
|
||||
} else {
|
||||
// Disconnect and clean up the remote desktop
|
||||
|
@ -11725,7 +11742,7 @@
|
|||
// Check device group link permission
|
||||
var rights = 0, r = mesh.links[userid];
|
||||
if (r != null) {
|
||||
if (rights == 0xFFFFFFFF) { return 0xFFFFFFFF; } // User has full rights thru a device group link, stop here.
|
||||
if (r.rights == 0xFFFFFFFF) { return 0xFFFFFFFF; } // User has full rights thru a device group link, stop here.
|
||||
rights = r.rights;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue