Started work on viewonly remote desktop server option.

Ylian Saint-Hilaire committed Jul 17, 2021 at 22:16 UTC c9129a2d2fa63d9cc9f7df58ed415bb808770418
4 files changed +18 -2
agents/meshcore.js
+3 -2
@@ -36,7 +36,7 @@ var MESHRIGHT_AGENTCONSOLE = 16;
36 var MESHRIGHT_SERVERFILES = 32;
37 var MESHRIGHT_WAKEDEVICE = 64;
38 var MESHRIGHT_SETNOTES = 128;
39 -var MESHRIGHT_REMOTEVIEW = 256;
39 +var MESHRIGHT_REMOTEVIEW = 256; // Remote View Only
40 var MESHRIGHT_NOTERMINAL = 512;
41 var MESHRIGHT_NOFILES = 1024;
42 var MESHRIGHT_NOAMT = 2048;
@@ -884,6 +884,7 @@ function handleServerCommand(data) {
884 tunnel.realname = (data.realname ? data.realname : data.username) + (data.guestname ? (' - ' + data.guestname) : '');
885 tunnel.guestname = data.guestname;
886 tunnel.userid = data.userid;
887 + tunnel.desktopviewonly = data.desktopviewonly;
888 tunnel.remoteaddr = data.remoteaddr;
889 tunnel.state = 0;
890 tunnel.url = xurl;
@@ -2151,7 +2152,7 @@ function onTunnelData(data) {
2152 this.httprequest.desktop.kvm.users = [this.httprequest.username];
2153 }
2154
2154 - if ((this.httprequest.rights == 0xFFFFFFFF) || (((this.httprequest.rights & MESHRIGHT_REMOTECONTROL) != 0) && ((this.httprequest.rights & MESHRIGHT_REMOTEVIEW) == 0))) {
2155 + if ((this.httprequest.desktopviewonly != true) && ((this.httprequest.rights == 0xFFFFFFFF) || (((this.httprequest.rights & MESHRIGHT_REMOTECONTROL) != 0) && ((this.httprequest.rights & MESHRIGHT_REMOTEVIEW) == 0)))) {
2156 // If we have remote control rights, pipe the KVM input
2157 this.pipe(this.httprequest.desktop.kvm, { dataTypeSkip: 1, end: false }); // 0 = Binary, 1 = Text. Pipe the Browser --> KVM input.
2158 } else {
meshcentral-config-schema.json
+11
@@ -510,6 +510,17 @@
510 }
511 }
512 },
513 + "desktop": {
514 + "type": "object",
515 + "description": "Values that affect the remote desktop feature",
516 + "properties": {
517 + "viewonly": {
518 + "type": "boolean",
519 + "description": "When set to true, the remote desktop feature is view only.",
520 + "default": "false"
521 + }
522 + }
523 + },
524 "amtManager": {
525 "type": "object",
526 "additionalProperties": false,
meshuser.js
+3
@@ -247,6 +247,9 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
247 if (typeof node.consent == 'number') { command.consent |= node.consent; } // Add node user consent
248 if (typeof user.consent == 'number') { command.consent |= user.consent; } // Add user consent
249
250 + // If desktop is viewonly, add this here.
251 + if ((typeof domain.desktop == 'object') && (domain.desktop.viewonly == true)) { command.desktopviewonly = true; }
252 +
253 // Check if we need to add consent flags because of a user group link
254 if ((user.links != null) && (user.links[mesh._id] == null) && (user.links[node._id] == null)) {
255 // This user does not have a direct link to the device group or device. Find all user groups the would cause the link.
webserver.js
+1
@@ -2818,6 +2818,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
2818 if (domain.localsessionrecording === false) { features2 += 0x00000400; } // Disable local recording feature
2819 if (domain.clipboardget == false) { features2 += 0x00000800; } // Disable clipboard get
2820 if (domain.clipboardset == false) { features2 += 0x00001000; } // Disable clipboard set
2821 + if ((typeof domain.desktop != 'object') || (domain.desktop.viewonly != false)) { features2 += 0x00002000; } // Indicates remote desktop is viewonly
2822 return { features: features, features2: features2 };
2823 }
2824