1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Added support for user notification.

This commit is contained in:
Ylian Saint-Hilaire 2019-04-12 14:19:03 -07:00
parent 696c842899
commit c081a22016
11 changed files with 108 additions and 23 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1645,6 +1645,7 @@
if (message.event.name) { meshes[message.event.meshid].name = message.event.name; }
if (message.event.desc) { meshes[message.event.meshid].desc = message.event.desc; }
if (message.event.flags != null) { meshes[message.event.meshid].flags = message.event.flags; }
if (message.event.consent != null) { meshes[message.event.meshid].consent = message.event.consent; }
if (message.event.links) { meshes[message.event.meshid].links = message.event.links; }
if (message.event.amt) { meshes[message.event.meshid].amt = message.event.amt; }
@ -5949,6 +5950,10 @@
x += addHtmlValue('Name', addLinkConditional(EscapeHtml(currentMesh.name), 'p20editmesh(1)', (meshrights & 1) != 0));
x += addHtmlValue('Description', addLinkConditional(((currentMesh.desc && currentMesh.desc != '')?EscapeHtml(currentMesh.desc):'<i>None</i>'), 'p20editmesh(2)', (meshrights & 1) != 0));
// Display group type
x += addHtmlValue('Type', meshtype);
//x += addHtmlValue('Identifier', currentMesh._id.split('/')[2]);
// Display features
var meshFeatures = [];
if (currentMesh.flags) {
@ -5957,11 +5962,22 @@
}
meshFeatures = meshFeatures.join(', ');
if (meshFeatures == '') { meshFeatures = '<i>None</i>'; }
x += addHtmlValue('Features', addLinkConditional(meshFeatures, 'p20editmeshfeatures()', (meshrights & 1) != 0));
x += addHtmlValue('Features', addLinkConditional(meshFeatures, 'p20editmeshfeatures()', meshrights & 1));
// Display group type
x += addHtmlValue('Type', meshtype);
//x += addHtmlValue('Identifier', currentMesh._id.split('/')[2]);
// Display user consent
meshFeatures = [];
var consent = 0;
if (currentMesh.consent) { consent = currentMesh.consent; }
if (serverinfo.consent) { consent |= serverinfo.consent; }
if (consent & 1) { meshFeatures.push('Desktop Notify'); }
if (consent & 2) { meshFeatures.push('Terminal Notify'); }
if (consent & 4) { meshFeatures.push('Files Notify'); }
//if ((consent & 7) == 7) { meshFeatures.push('Always Notify'); } else if ((currentMesh.consent & 7) != 0) { meshFeatures.push('Notify Sometimes'); }
//if ((consent & 56) == 56) { meshFeatures.push('Always Blink Border'); } else if ((currentMesh.consent & 56) != 0) { meshFeatures.push('Blick Border Sometimes'); }
meshFeatures = meshFeatures.join(', ');
if (meshFeatures == '') { meshFeatures = '<i>None</i>'; }
x += addHtmlValue('User Consent', addLinkConditional(meshFeatures, 'p20editmeshconsent()', meshrights & 1));
// Intel AMT setup
if (currentMesh.mtype == 2) {
@ -5973,7 +5989,7 @@
if (currentMesh.amt.cirasetup == 2) { intelAmtPolicy += ' + CIRA'; }
}
}
x += addHtmlValue('Intel&reg; AMT', addLinkConditional(intelAmtPolicy, 'p20editMeshAmt()', (meshrights & 0xFFFFFFFF) != 0));
x += addHtmlValue('Intel&reg; AMT', addLinkConditional(intelAmtPolicy, 'p20editMeshAmt()', meshrights & 1));
}
// Display group note support
@ -6117,6 +6133,40 @@
QE('idx_dlgOkButton', Q('dp20meshname').value.length > 0);
}
function p20editmeshconsent() {
if (xxdialogMode) return;
var x = '', consent = (currentMesh.consent) ? currentMesh.consent : 0;
x += '<div style="width:100%;border-bottom:1px solid gray;margin-bottom:5px"><b>Desktop</b></div>';
x += "<div><input type=checkbox id=d20flag1 " + ((consent & 0x0001) ? 'checked' : '') + ">Notify User</div>";
//x += "<div><input type=checkbox id=d20flag2 " + ((consent & 0x0008) ? 'checked' : '') + ">Blinking Border</div>";
x += '<div style="width:100%;border-bottom:1px solid gray;margin-bottom:5px;margin-top:8px"><b>Terminal</b></div>';
x += "<div><input type=checkbox id=d20flag3 " + ((consent & 0x0002) ? 'checked' : '') + ">Notify User</div>";
//x += "<div><input type=checkbox id=d20flag4 " + ((consent & 0x0010) ? 'checked' : '') + ">Blinking Border</div>";
x += '<div style="width:100%;border-bottom:1px solid gray;margin-bottom:5px;margin-top:8px"><b>Files</b></div>';
x += "<div><input type=checkbox id=d20flag5 " + ((consent & 0x0004) ? 'checked' : '') + ">Notify User</div>";
//x += "<div><input type=checkbox id=d20flag6 " + ((consent & 0x0020) ? 'checked' : '') + ">Blinking Border</div>";
setDialogMode(2, "Edit Device Group User Consent", 3, p20editmeshconsentEx, x);
if (serverinfo.consent) {
if (serverinfo.consent & 1) { Q('d20flag1').checked = true; }
if (serverinfo.consent & 2) { Q('d20flag3').checked = true; }
if (serverinfo.consent & 4) { Q('d20flag5').checked = true; }
QE('d20flag1', !(serverinfo.consent & 1));
QE('d20flag3', !(serverinfo.consent & 2));
QE('d20flag5', !(serverinfo.consent & 4));
}
}
function p20editmeshconsentEx() {
var consent = 0;
if (Q('d20flag1').checked) { consent += 0x0001; }
//if (Q('d20flag2').checked) { consent += 0x0008; }
if (Q('d20flag3').checked) { consent += 0x0002; }
//if (Q('d20flag4').checked) { consent += 0x0010; }
if (Q('d20flag5').checked) { consent += 0x0004; }
//if (Q('d20flag6').checked) { consent += 0x0020; }
meshserver.send({ action: 'editmesh', meshid: currentMesh._id, consent: consent });
}
function p20editmeshfeatures() {
if (xxdialogMode) return;
var flags = (currentMesh.flags)?currentMesh.flags:0;