Added user consent config options, #3692
This commit is contained in:
parent
4b4419f581
commit
e160f8e73f
|
@ -1025,18 +1025,15 @@ function handleServerCommand(data) {
|
|||
tunnel.realname = (data.realname ? data.realname : data.username) + (data.guestname ? (' - ' + data.guestname) : '');
|
||||
tunnel.guestname = data.guestname;
|
||||
tunnel.userid = data.userid;
|
||||
|
||||
if (server_check_consentTimer(tunnel.userid)) {
|
||||
sendConsoleText('Deleting Consent Requirement');
|
||||
tunnel.consent = (tunnel.consent & -57);
|
||||
}
|
||||
|
||||
if (server_check_consentTimer(tunnel.userid)) { tunnel.consent = (tunnel.consent & -57); } // Deleting Consent Requirement
|
||||
tunnel.desktopviewonly = data.desktopviewonly;
|
||||
tunnel.remoteaddr = data.remoteaddr;
|
||||
tunnel.state = 0;
|
||||
tunnel.url = xurl;
|
||||
tunnel.protocol = 0;
|
||||
tunnel.soptions = data.soptions;
|
||||
tunnel.consentTimeout = (tunnel.soptions && tunnel.soptions.consentTimeout) ? tunnel.soptions.consentTimeout : 30;
|
||||
tunnel.consentAutoAccept = (tunnel.soptions && (tunnel.soptions.consentAutoAccept === true));
|
||||
tunnel.tcpaddr = data.tcpaddr;
|
||||
tunnel.tcpport = data.tcpport;
|
||||
tunnel.udpaddr = data.udpaddr;
|
||||
|
@ -2068,28 +2065,25 @@ function onTunnelData(data) {
|
|||
}
|
||||
if (process.platform == 'win32') {
|
||||
var enhanced = false;
|
||||
try {
|
||||
require('win-userconsent');
|
||||
enhanced = true;
|
||||
} catch (ex) { }
|
||||
try { require('win-userconsent'); enhanced = true; } catch (ex) { }
|
||||
if (enhanced) {
|
||||
var ipr = server_getUserImage(this.httprequest.userid);
|
||||
ipr.consentTitle = consentTitle;
|
||||
ipr.consentMessage = consentMessage;
|
||||
ipr.consentTimeout = this.httprequest.consentTimeout;
|
||||
ipr.consentAutoAccept = this.httprequest.consentAutoAccept; // TODO: If true, consent timeout must accept.
|
||||
ipr.username = this.httprequest.realname;
|
||||
ipr.translations = { Allow: currentTranslation['allow'], Deny: currentTranslation['deny'], Auto: currentTranslation['autoAllowForFive'], Caption: consentMessage };
|
||||
this.httprequest.tpromise._consent = ipr.then(function (img) {
|
||||
this.consent = require('win-userconsent').create(this.consentTitle, this.consentMessage, this.username, { b64Image: img.split(',').pop(), timeout: 30000, translations: this.translations, background: color_options.background, foreground: color_options.foreground });
|
||||
this.consent = require('win-userconsent').create(this.consentTitle, this.consentMessage, this.username, { b64Image: img.split(',').pop(), timeout: this.consentTimeout * 1000, translations: this.translations, background: color_options.background, foreground: color_options.foreground });
|
||||
this.__childPromise.close = this.consent.close.bind(this.consent);
|
||||
return (this.consent);
|
||||
});
|
||||
} else {
|
||||
this.httprequest.tpromise._consent = require('message-box').create(consentTitle, consentMessage, this.consentTimeout);
|
||||
}
|
||||
else {
|
||||
this.httprequest.tpromise._consent = require('message-box').create(consentTitle, consentMessage, 30);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.httprequest.tpromise._consent = require('message-box').create(consentTitle, consentMessage, 30);
|
||||
} else {
|
||||
this.httprequest.tpromise._consent = require('message-box').create(consentTitle, consentMessage, this.consentTimeout);
|
||||
}
|
||||
this.httprequest.tpromise._consent.retPromise = this.httprequest.tpromise;
|
||||
this.httprequest.tpromise._consent.then(
|
||||
|
@ -2428,29 +2422,28 @@ function onTunnelData(data) {
|
|||
var pr;
|
||||
if (process.platform == 'win32') {
|
||||
var enhanced = false;
|
||||
try {
|
||||
require('win-userconsent');
|
||||
enhanced = true;
|
||||
} catch (ex) { }
|
||||
try { require('win-userconsent'); enhanced = true; } catch (ex) { }
|
||||
if (enhanced) {
|
||||
var ipr = server_getUserImage(this.httprequest.userid);
|
||||
ipr.consentTitle = consentTitle;
|
||||
ipr.consentMessage = consentMessage;
|
||||
ipr.consentTimeout = this.httprequest.consentTimeout;
|
||||
ipr.consentAutoAccept = this.httprequest.consentAutoAccept; // TODO: If true, consent timeout must accept.
|
||||
ipr.tsid = tsid;
|
||||
ipr.username = this.httprequest.realname;
|
||||
ipr.translation = { Allow: currentTranslation['allow'], Deny: currentTranslation['deny'], Auto: currentTranslation['autoAllowForFive'], Caption: consentMessage };
|
||||
pr = ipr.then(function (img) {
|
||||
this.consent = require('win-userconsent').create(this.consentTitle, this.consentMessage, this.username, { b64Image: img.split(',').pop(), uid: this.tsid, timeout: 30000, translations: this.translation, background: color_options.background, foreground: color_options.foreground });
|
||||
this.consent = require('win-userconsent').create(this.consentTitle, this.consentMessage, this.username, { b64Image: img.split(',').pop(), uid: this.tsid, timeout: this.consentTimeout * 1000, translations: this.translation, background: color_options.background, foreground: color_options.foreground });
|
||||
this.__childPromise.close = this.consent.close.bind(this.consent);
|
||||
return (this.consent);
|
||||
});
|
||||
}
|
||||
else {
|
||||
pr = require('message-box').create(consentTitle, consentMessage, 30, null, tsid);
|
||||
pr = require('message-box').create(consentTitle, consentMessage, this.consentTimeout, null, tsid);
|
||||
}
|
||||
}
|
||||
else {
|
||||
pr = require('message-box').create(consentTitle, consentMessage, 30, null, tsid);
|
||||
pr = require('message-box').create(consentTitle, consentMessage, this.consentTimeout, null, tsid);
|
||||
}
|
||||
pr.ws = this;
|
||||
this.pause();
|
||||
|
@ -2612,26 +2605,25 @@ function onTunnelData(data) {
|
|||
var pr;
|
||||
if (process.platform == 'win32') {
|
||||
var enhanced = false;
|
||||
try {
|
||||
require('win-userconsent');
|
||||
enhanced = true;
|
||||
} catch (ex) { }
|
||||
try { require('win-userconsent'); enhanced = true; } catch (ex) { }
|
||||
if (enhanced) {
|
||||
var ipr = server_getUserImage(this.httprequest.userid);
|
||||
ipr.consentTitle = consentTitle;
|
||||
ipr.consentMessage = consentMessage;
|
||||
ipr.consentTimeout = this.httprequest.consentTimeout;
|
||||
ipr.consentAutoAccept = this.httprequest.consentAutoAccept; // TODO: If true, consent timeout must accept.
|
||||
ipr.username = this.httprequest.realname;
|
||||
ipr.translations = { Allow: currentTranslation['allow'], Deny: currentTranslation['deny'], Auto: currentTranslation['autoAllowForFive'], Caption: consentMessage };
|
||||
pr = ipr.then(function (img) {
|
||||
this.consent = require('win-userconsent').create(this.consentTitle, this.consentMessage, this.username, { b64Image: img.split(',').pop(), timeout: 30000, translations: this.translations, background: color_options.background, foreground: color_options.foreground });
|
||||
this.consent = require('win-userconsent').create(this.consentTitle, this.consentMessage, this.username, { b64Image: img.split(',').pop(), timeout: this.consentTimeout * 1000, translations: this.translations, background: color_options.background, foreground: color_options.foreground });
|
||||
this.__childPromise.close = this.consent.close.bind(this.consent);
|
||||
return (this.consent);
|
||||
});
|
||||
} else {
|
||||
pr = require('message-box').create(consentTitle, consentMessage, 30, null);
|
||||
pr = require('message-box').create(consentTitle, consentMessage, this.consentTimeout, null);
|
||||
}
|
||||
} else {
|
||||
pr = require('message-box').create(consentTitle, consentMessage, 30, null);
|
||||
pr = require('message-box').create(consentTitle, consentMessage, this.consentTimeout, null);
|
||||
}
|
||||
pr.ws = this;
|
||||
this.pause();
|
||||
|
|
|
@ -492,7 +492,9 @@
|
|||
"Title": { "type": "string" },
|
||||
"Desktop": { "type": "string" },
|
||||
"Terminal": { "type": "string" },
|
||||
"Files": { "type": "string" }
|
||||
"Files": { "type": "string" },
|
||||
"consentTimeout": { "type": "integer", "default": 30, "description": "How long in seconds to show the user consent dialog box." },
|
||||
"autoAcceptOnTimeout": { "type": "boolean", "default": false, "description": "If true, user consent is accepted after the timeout." }
|
||||
}
|
||||
},
|
||||
"notificationMessages": {
|
||||
|
|
|
@ -1339,6 +1339,8 @@ function CreateMeshRelayEx2(parent, ws, req, domain, user, cookie) {
|
|||
if (typeof domain.consentmessages.desktop == 'string') { command.soptions.consentMsgDesktop = domain.consentmessages.desktop; }
|
||||
if (typeof domain.consentmessages.terminal == 'string') { command.soptions.consentMsgTerminal = domain.consentmessages.terminal; }
|
||||
if (typeof domain.consentmessages.files == 'string') { command.soptions.consentMsgFiles = domain.consentmessages.files; }
|
||||
if ((typeof domain.consentmessages.consenttimeout == 'number') && (domain.consentmessages.consenttimeout > 0)) { command.soptions.consentTimeout = domain.consentmessages.consenttimeout; }
|
||||
if (domain.consentmessages.autoacceptontimeout === true) { command.soptions.consentAutoAccept = true; }
|
||||
}
|
||||
if (typeof domain.notificationmessages == 'object') {
|
||||
if (typeof domain.notificationmessages.title == 'string') { command.soptions.notifyTitle = domain.notificationmessages.title; }
|
||||
|
|
|
@ -882,6 +882,8 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
|
|||
if (typeof domain.consentmessages.desktop == 'string') { command.soptions.consentMsgDesktop = domain.consentmessages.desktop; }
|
||||
if (typeof domain.consentmessages.terminal == 'string') { command.soptions.consentMsgTerminal = domain.consentmessages.terminal; }
|
||||
if (typeof domain.consentmessages.files == 'string') { command.soptions.consentMsgFiles = domain.consentmessages.files; }
|
||||
if ((typeof domain.consentmessages.consenttimeout == 'number') && (domain.consentmessages.consenttimeout > 0)) { command.soptions.consentTimeout = domain.consentmessages.consenttimeout; }
|
||||
if (domain.consentmessages.autoacceptontimeout === true) { command.soptions.consentAutoAccept = true; }
|
||||
}
|
||||
if (typeof domain.notificationmessages == 'object') {
|
||||
if (typeof domain.notificationmessages.title == 'string') { command.soptions.notifyTitle = domain.notificationmessages.title; }
|
||||
|
@ -918,6 +920,8 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
|
|||
if (typeof domain.consentmessages.desktop == 'string') { command.soptions.consentMsgDesktop = domain.consentmessages.desktop; }
|
||||
if (typeof domain.consentmessages.terminal == 'string') { command.soptions.consentMsgTerminal = domain.consentmessages.terminal; }
|
||||
if (typeof domain.consentmessages.files == 'string') { command.soptions.consentMsgFiles = domain.consentmessages.files; }
|
||||
if ((typeof domain.consentmessages.consenttimeout == 'number') && (domain.consentmessages.consenttimeout > 0)) { command.soptions.consentTimeout = domain.consentmessages.consenttimeout; }
|
||||
if (domain.consentmessages.autoacceptontimeout === true) { command.soptions.consentAutoAccept = true; }
|
||||
}
|
||||
if (typeof domain.notificationmessages == 'object') {
|
||||
if (typeof domain.notificationmessages.title == 'string') { command.soptions.notifyTitle = domain.notificationmessages.title; }
|
||||
|
@ -934,6 +938,8 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
|
|||
if (typeof domain.consentmessages.desktop == 'string') { command.soptions.consentMsgDesktop = domain.consentmessages.desktop; }
|
||||
if (typeof domain.consentmessages.terminal == 'string') { command.soptions.consentMsgTerminal = domain.consentmessages.terminal; }
|
||||
if (typeof domain.consentmessages.files == 'string') { command.soptions.consentMsgFiles = domain.consentmessages.files; }
|
||||
if ((typeof domain.consentmessages.consenttimeout == 'number') && (domain.consentmessages.consenttimeout > 0)) { command.soptions.consentTimeout = domain.consentmessages.consenttimeout; }
|
||||
if (domain.consentmessages.autoacceptontimeout === true) { command.soptions.consentAutoAccept = true; }
|
||||
}
|
||||
if (typeof domain.notificationmessages == 'object') {
|
||||
if (typeof domain.notificationmessages.title == 'string') { command.soptions.notifyTitle = domain.notificationmessages.title; }
|
||||
|
@ -983,6 +989,8 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
|
|||
if (typeof domain.consentmessages.desktop == 'string') { command.soptions.consentMsgDesktop = domain.consentmessages.desktop; }
|
||||
if (typeof domain.consentmessages.terminal == 'string') { command.soptions.consentMsgTerminal = domain.consentmessages.terminal; }
|
||||
if (typeof domain.consentmessages.files == 'string') { command.soptions.consentMsgFiles = domain.consentmessages.files; }
|
||||
if ((typeof domain.consentmessages.consenttimeout == 'number') && (domain.consentmessages.consenttimeout > 0)) { command.soptions.consentTimeout = domain.consentmessages.consenttimeout; }
|
||||
if (domain.consentmessages.autoacceptontimeout === true) { command.soptions.consentAutoAccept = true; }
|
||||
}
|
||||
if (typeof domain.notificationmessages == 'object') {
|
||||
if (typeof domain.notificationmessages.title == 'string') { command.soptions.notifyTitle = domain.notificationmessages.title; }
|
||||
|
|
|
@ -868,6 +868,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||
if (typeof domain.consentmessages.desktop == 'string') { command.soptions.consentMsgDesktop = domain.consentmessages.desktop; }
|
||||
if (typeof domain.consentmessages.terminal == 'string') { command.soptions.consentMsgTerminal = domain.consentmessages.terminal; }
|
||||
if (typeof domain.consentmessages.files == 'string') { command.soptions.consentMsgFiles = domain.consentmessages.files; }
|
||||
if ((typeof domain.consentmessages.consenttimeout == 'number') && (domain.consentmessages.consenttimeout > 0)) { command.soptions.consentTimeout = domain.consentmessages.consenttimeout; }
|
||||
if (domain.consentmessages.autoacceptontimeout === true) { command.soptions.consentAutoAccept = true; }
|
||||
}
|
||||
if (typeof domain.notificationmessages == 'object') {
|
||||
if (typeof domain.notificationmessages.title == 'string') { command.soptions.notifyTitle = domain.notificationmessages.title; }
|
||||
|
|
|
@ -236,7 +236,9 @@
|
|||
"title": "MeshCentral",
|
||||
"desktop": "{0} requesting remote desktop access. Grant access?",
|
||||
"terminal": "{0} requesting remote terminal access. Grant access?",
|
||||
"files": "{0} requesting remote files access. Grant access?"
|
||||
"files": "{0} requesting remote files access. Grant access?",
|
||||
"consentTimeout": 30,
|
||||
"autoAcceptOnTimeout": false
|
||||
},
|
||||
"_notificationMessages": {
|
||||
"title": "MeshCentral",
|
||||
|
|
Loading…
Reference in New Issue