Added options to remove the SSH Connect and SFTP connect from the terminal and files tab when other options exist, #4214
Ylian Saint-Hilaire committed
Jul 5, 2022 at 14:25 UTC
e89effac46ac1d659eeeed27991c16a12f91047e
3 files changed
+13
-3
meshcentral-config-schema.json
+9
-1
@@ -616,10 +616,18 @@
616
"MaxSingleUserSessions": { "type": "integer", "default": null, "description": "Maximum number of sessions a single user can have. Each time a user opens a new browser tab or opens a new browser on a different computer, a new user session is created." }
617
}
618
},
619
+ "files": {
620
+ "type": "object",
621
+ "description": "Values that affect the files feature",
622
+ "properties": {
623
+ "sftpConnect" : { "type": "boolean", "default": true, "description": "When false, removes the 'SFTP Connect' button from the files tab unless this is the only possible option." }
624
+ }
625
+ },
626
"terminal": {
627
"type": "object",
628
"description": "Values that affect the terminal feature",
629
"properties": {
630
+ "sshConnect" : { "type": "boolean", "default": true, "description": "When false, removes the 'SSH Connect' button from the terminal tab unless this is the only possible option." },
631
"linuxShell": {
632
"type": "string",
633
"enum": [ "any", "root", "user", "login" ],
@@ -637,7 +645,7 @@
645
},
646
"desktop": {
647
"type": "object",
640
- "description": "Values that affect the remote desktop feature",
648
+ "description": "Values that affect the desktop feature",
649
"properties": {
650
"viewonly": {
651
"type": "boolean",
views/default.handlebars
+2
-2
@@ -9726,7 +9726,7 @@
9726
// Show the right buttons
9727
QV('disconnectbutton2span', (termState == true));
9728
QV('connectbutton2span', (termState == false) && (terminalNode.agent != null) && (terminalNode.agent.caps & 2) && (terminalNode.mtype != 3));
9729
- QV('connectbutton2sspan', (features2 & 0x00000200) && (termState == false) && (terminalNode.agent != null) && (terminalNode.agent.caps & 2) && (terminalNode.agent.id != 3) && (terminalNode.agent.id != 4));
9729
+ QV('connectbutton2sspan', (features2 & 0x00000200) && (termState == false) && (terminalNode.agent != null) && (terminalNode.agent.caps & 2) && (terminalNode.agent.id != 3) && (terminalNode.agent.id != 4) && ((features2 & 0x1000000) == 0));
9730
if (terminalNode.mtype == 1) {
9731
QV('connectbutton2hspan', (termState == false) && (terminalNode.intelamt != null) && (terminalNode.intelamt.state == 2));
9732
QV('terminalSizeDropDown', (termState == false) && (terminalNode.intelamt != null) && (terminalNode.intelamt.state == 2));
@@ -10160,7 +10160,7 @@
10160
QE('p13Connect', online);
10161
QE('p13Connects', online);
10162
QV('p13Connect', (files == null) && (filesNode.mtype == 2));
10163
- QV('p13Connects', (files == null) && (filesNode.agent != null) && (filesNode.agent.id != 3) && (filesNode.agent.id != 4));
10163
+ QV('p13Connects', (features2 & 0x200) && (files == null) && (filesNode.agent != null) && (filesNode.agent.id != 3) && (filesNode.agent.id != 4) && ((features2 & 0x800000) == 0));
10164
QV('p13Disconnect', files != null);
10165
if (((samenode == false) || (online == false)) && files) { files.Stop(); files = null; }
10166
p13setActions();
webserver.js
+2
@@ -2977,6 +2977,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
2977
if (domain.nightmode === 1) { features2 += 0x00100000; } // Always night mode
2978
if (domain.nightmode === 2) { features2 += 0x00200000; } // Always day mode
2979
if (domain.allowsavingdevicecredentials == false) { features2 += 0x00400000; } // Do not allow device credentials to be saved on the server
2980
+ if ((typeof domain.files == 'object') && (domain.files.sftpconnect === false)) { features2 += 0x00800000; } // Remove the "SFTP Connect" button in the "Files" tab when the device is agent managed
2981
+ if ((typeof domain.terminal == 'object') && (domain.terminal.sshconnect === false)) { features2 += 0x01000000; } // Remove the "SSH Connect" button in the "Terminal" tab when the device is agent managed
2982
return { features: features, features2: features2 };
2983
}
2984