Added device MeshCentral Router link filtering.
Ylian Saint-Hilaire committed
Feb 25, 2021 at 12:31 UTC
069656f6323bd5bd310608ffc2b6ef7aa3de019e
3 files changed
+11
-3
meshcentral-config-schema.json
+5
@@ -246,6 +246,11 @@
246
"port": {
247
"description": "The port on the remote device.",
248
"type": "number"
249
+ },
250
+ "filter": {
251
+ "description": "Array of node/domain/id or mesh/domain/id strings. When set, the link will only show up for the specified devices or device groups.",
252
+ "type": "array",
253
+ "items": { "type": "string" }
254
}
255
}
256
}
sample-config-advanced.json
+2
-1
@@ -157,7 +157,8 @@
157
{
158
"name": "HTTP",
159
"protocol": "http",
160
- "port": 80
160
+ "port": 80,
161
+ "_filter": [ "mesh//xxxx", "node//xxxx" ]
162
},
163
{
164
"name": "HTTPS",
views/default.handlebars
+4
-2
@@ -6115,8 +6115,10 @@
6115
if ((serverinfo.devicemeshrouterlinks != null) && (Array.isArray(serverinfo.devicemeshrouterlinks.extralinks))) {
6116
for (var i in serverinfo.devicemeshrouterlinks.extralinks) {
6117
var r = serverinfo.devicemeshrouterlinks.extralinks[i], p = 0;
6118
- if (typeof r.protocol == 'number') { p = r.protocol; } else if (r.protocol == 'http') { p = 1; } else if (r.protocol == 'https') { p = 2; } else if (r.protocol == 'rdp') { p = 3; } else if (r.protocol == 'ssh') { p = 4; } else if (r.protocol == 'scp') { p = 5; }
6119
- x += '<a href=# onclick=p10MCRouter("' + node._id + '",' + p + ',' + r.port + ') title="' + "Requires installation of MeshCentral Router." + '">' + r.name + '</a> ';
6118
+ if ((r.filter == null) || (Array.isArray(r.filter) && ((r.filter.indexOf(mesh._id) >= 0) || (r.filter.indexOf(node._id) >= 0)))) {
6119
+ if (typeof r.protocol == 'number') { p = r.protocol; } else if (r.protocol == 'http') { p = 1; } else if (r.protocol == 'https') { p = 2; } else if (r.protocol == 'rdp') { p = 3; } else if (r.protocol == 'ssh') { p = 4; } else if (r.protocol == 'scp') { p = 5; }
6120
+ x += '<a href=# onclick=p10MCRouter("' + node._id + '",' + p + ',' + r.port + ') title="' + "Requires installation of MeshCentral Router." + '">' + r.name + '</a> ';
6121
+ }
6122
}
6123
}
6124
}