Can now directly change user permissions in a device group.

This commit is contained in:
Ylian Saint-Hilaire 2019-07-23 13:37:12 -07:00
parent 32cc09e813
commit 1e1df4b874
6 changed files with 208 additions and 94 deletions

View File

@ -1687,7 +1687,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
if (newuser != null) { if (newuser != null) {
// Add mesh to user // Add mesh to user
if (newuser.links == null) newuser.links = {}; if (newuser.links == null) newuser.links = {};
newuser.links[command.meshid] = { rights: command.meshadmin }; if (newuser.links[command.meshid]) { newuser.links[command.meshid].rights = command.meshadmin; } else { newuser.links[command.meshid] = { rights: command.meshadmin }; }
db.SetUser(newuser); db.SetUser(newuser);
parent.parent.DispatchEvent([newuser._id], obj, 'resubscribe'); parent.parent.DispatchEvent([newuser._id], obj, 'resubscribe');

View File

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.3.8-i", "version": "0.3.8-k",
"keywords": [ "keywords": [
"Remote Management", "Remote Management",
"Intel AMT", "Intel AMT",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -398,7 +398,8 @@
<input id="deskActionsBtn" type=button style="margin-left:3px" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value=Actions onclick=deviceActionFunction() /> <input id="deskActionsBtn" type=button style="margin-left:3px" title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value=Actions onclick=deviceActionFunction() />
<input type="button" value="Settings" title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick="showDesktopSettings()"> <input type="button" value="Settings" title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick="showDesktopSettings()">
<input type="button" title="Change the power state of the remote machine" onkeypress="return false" onkeydown="return false" value="Power Actions..." onclick="showPowerActionDlg()" style="display:none"> <input type="button" title="Change the power state of the remote machine" onkeypress="return false" onkeydown="return false" value="Power Actions..." onclick="showPowerActionDlg()" style="display:none">
<input id="DeskCAD" type="button" value="CtrlAltDel" onkeypress="return false" onkeydown="return false" onclick="sendCAD()"> <!--<input id="DeskCAD" type="button" value="CtrlAltDel" onkeypress="return false" onkeydown="return false" onclick="sendCAD()">-->
<input id="DeskSpecialKeys" type="button" value="Special" onkeypress="return false" onkeydown="return false" onclick="sendSpecialKeys()">
<input id="DeskSoftKeys" type="button" value="Keys" onkeypress="return false" onkeydown="return false" onclick="toggleSoftKeys(1)"> <input id="DeskSoftKeys" type="button" value="Keys" onkeypress="return false" onkeydown="return false" onclick="toggleSoftKeys(1)">
<label><span id="DeskControlSpan" style="display:none" title="Toggle mouse and keyboard input"><input id="DeskControl" type="checkbox" onkeypress="return false" onkeydown="return false">Input</span></label> <label><span id="DeskControlSpan" style="display:none" title="Toggle mouse and keyboard input"><input id="DeskControl" type="checkbox" onkeypress="return false" onkeydown="return false">Input</span></label>
</div> </div>
@ -509,6 +510,22 @@
<div id=dialog2 style="margin:auto;margin:3px"> <div id=dialog2 style="margin:auto;margin:3px">
<div id=id_dialogOptions></div> <div id=id_dialogOptions></div>
</div> </div>
<div id=dialog3 style="margin:auto;margin:3px">
<select id="deskkeys" style="width:100%">
<option value=10>Ctrl+Alt+Del</option>
<option value=11>Tab</option>
<option value=5>Win</option>
<option value=0>Win+Down</option>
<option value=1>Win+Up</option>
<option value=2>Win+L</option>
<option value=3>Win+M</option>
<option value=4>Shift+Win+M</option>
<option value=6>Win+R</option>
<option value=7>Alt-F4</option>
<option value=8>Ctrl-W</option>
<option value=9>Alt-Tab</option>
</select>
</div>
<div id=dialog7 style="margin:auto;margin:3px"> <div id=dialog7 style="margin:auto;margin:3px">
<div id="d7meshkvm"> <div id="d7meshkvm">
<h4 style="width:100%;border-bottom:1px solid gray">Agent Remote Desktop</h4> <h4 style="width:100%;border-bottom:1px solid gray">Agent Remote Desktop</h4>
@ -2371,50 +2388,98 @@
QS('Desk')['margin-bottom'] = x + 'px'; QS('Desk')['margin-bottom'] = x + 'px';
} }
/*
// Remote desktop special key combos for Windows // Remote desktop special key combos for Windows
function deskSendKeys() { function deskSendKeys() {
if (xxdialogMode || desktop == null || desktop.State != 3) return; if (xxdialogMode || desktop == null || desktop.State != 3) return;
var ks = Q('deskkeys').value; var ks = Q('deskkeys').value;
if (ks == 0) { // WIN+Down arrow if (ks == 0) { // WIN+Down arrow
if (desktop.contype == 2) { if (desktop.contype == 2) {
desktop.m.sendkey([[0xffe7,1],[0xff54,1],[0xff54,0],[0xffe7,0]]); // Intel AMT: Meta-left down, Down arrow press, Down arrow release, Meta-left release desktop.m.sendkey([[0xffe7, 1], [0xff54, 1], [0xff54, 0], [0xffe7, 0]]); // Intel AMT: Meta-left down, Down arrow press, Down arrow release, Meta-left release
} else { } else {
desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,0x5B],[desktop.m.KeyAction.DOWN,40],[desktop.m.KeyAction.UP,40],[desktop.m.KeyAction.EXUP,0x5B]]); // Agent: L-Winkey press, Down arrow press, Down arrow release, L-Winkey release desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 0x5B], [desktop.m.KeyAction.DOWN, 40], [desktop.m.KeyAction.UP, 40], [desktop.m.KeyAction.EXUP, 0x5B]]); // Agent: L-Winkey press, Down arrow press, Down arrow release, L-Winkey release
} }
} else if (ks == 1) { // WIN+Up arrow } else if (ks == 1) { // WIN+Up arrow
if (desktop.contype == 2) { if (desktop.contype == 2) {
desktop.m.sendkey([[0xffe7,1],[0xff52,1],[0xff52,0],[0xffe7,0]]); // Intel AMT: Meta-left down, Up arrow press, Up arrow release, Meta-left release desktop.m.sendkey([[0xffe7, 1], [0xff52, 1], [0xff52, 0], [0xffe7, 0]]); // Intel AMT: Meta-left down, Up arrow press, Up arrow release, Meta-left release
} else { } else {
desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,0x5B],[desktop.m.KeyAction.DOWN,38],[desktop.m.KeyAction.UP,38],[desktop.m.KeyAction.EXUP,0x5B]]); // MeshAgent: L-Winkey press, Up arrow press, Up arrow release, L-Winkey release desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 0x5B], [desktop.m.KeyAction.DOWN, 38], [desktop.m.KeyAction.UP, 38], [desktop.m.KeyAction.EXUP, 0x5B]]); // MeshAgent: L-Winkey press, Up arrow press, Up arrow release, L-Winkey release
} }
} else if (ks == 2) { // WIN+L arrow } else if (ks == 2) { // WIN+L arrow
if (desktop.contype == 2) { if (desktop.contype == 2) {
desktop.m.sendkey([[0xffe7,1],[0x6c,1],[0x6c,0],[0xffe7,0]]); // Intel AMT: Meta-left down, 'l' press, 'l' release, Meta-left release desktop.m.sendkey([[0xffe7, 1], [0x6c, 1], [0x6c, 0], [0xffe7, 0]]); // Intel AMT: Meta-left down, 'l' press, 'l' release, Meta-left release
} else { } else {
desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,0x5B],[desktop.m.KeyAction.DOWN,76],[desktop.m.KeyAction.UP,76],[desktop.m.KeyAction.EXUP,0x5B]]); // MeshAgent: L-Winkey press, 'L' press, 'L' release, L-Winkey release desktop.sendCtrlMsg('{"action":"lock"}');
//desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,0x5B],[desktop.m.KeyAction.DOWN,76],[desktop.m.KeyAction.UP,76],[desktop.m.KeyAction.EXUP,0x5B]]); // MeshAgent: L-Winkey press, 'L' press, 'L' release, L-Winkey release
//desktop.m.SendKeyMsgKC(desktop.m.KeyAction.EXDOWN, 0x5B);
//desktop.m.SendKeyMsgKC(desktop.m.KeyAction.DOWN, 76);
//desktop.m.SendKeyMsgKC(desktop.m.KeyAction.UP, 76);
//desktop.m.SendKeyMsgKC(desktop.m.KeyAction.EXUP, 0x5B);
} }
} else if (ks == 3) { // WIN+M arrow } else if (ks == 3) { // WIN+M arrow
if (desktop.contype == 2) { if (desktop.contype == 2) {
desktop.m.sendkey([[0xffe7,1],[0x6d,1],[0x6d,0],[0xffe7,0]]); // Intel AMT: Meta-left down, 'm' press, 'm' release, Meta-left release desktop.m.sendkey([[0xffe7, 1], [0x6d, 1], [0x6d, 0], [0xffe7, 0]]); // Intel AMT: Meta-left down, 'm' press, 'm' release, Meta-left release
} else { } else {
desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN,0x5B],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,0x5B]]); // MeshAgent: L-Winkey press, 'M' press, 'M' release, L-Winkey release desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 0x5B], [desktop.m.KeyAction.DOWN, 77], [desktop.m.KeyAction.UP, 77], [desktop.m.KeyAction.EXUP, 0x5B]]); // MeshAgent: L-Winkey press, 'M' press, 'M' release, L-Winkey release
} }
} else if (ks == 4) { // Shift+WIN+M arrow } else if (ks == 4) { // Shift+WIN+M arrow
if (desktop.contype == 2) { if (desktop.contype == 2) {
desktop.m.sendkey([[0xffe1,1],[0xffe7,1],[0x6d,1],[0x6d,0],[0xffe7,0],[0xffe1,0]]); // Intel AMT: Shift-left down, Meta-left down, 'm' press, 'm' release, Meta-left release, Shift-left release desktop.m.sendkey([[0xffe1, 1], [0xffe7, 1], [0x6d, 1], [0x6d, 0], [0xffe7, 0], [0xffe1, 0]]); // Intel AMT: Shift-left down, Meta-left down, 'm' press, 'm' release, Meta-left release, Shift-left release
} else { } else {
desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN,16],[desktop.m.KeyAction.EXDOWN,0x5B],[desktop.m.KeyAction.DOWN,77],[desktop.m.KeyAction.UP,77],[desktop.m.KeyAction.EXUP,0x5B],[desktop.m.KeyAction.UP, 16]]); // MeshAgent: L-shift press, L-Winkey press, 'M' press, 'M' release, L-Winkey release, L-shift release desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN, 16], [desktop.m.KeyAction.EXDOWN, 0x5B], [desktop.m.KeyAction.DOWN, 77], [desktop.m.KeyAction.UP, 77], [desktop.m.KeyAction.EXUP, 0x5B], [desktop.m.KeyAction.UP, 16]]); // MeshAgent: L-shift press, L-Winkey press, 'M' press, 'M' release, L-Winkey release, L-shift release
}
} else if (ks == 5) { // WIN
if (desktop.contype == 2) {
desktop.m.sendkey([[0xffe7, 1], [0xffe7, 0]]); // Intel AMT: Meta-left down, Meta-left release
} else {
desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 0x5B], [desktop.m.KeyAction.EXUP, 0x5B]]); // MeshAgent: L-Winkey press, L-Winkey release
}
} else if (ks == 6) { // WIN+R
if (desktop.contype == 2) {
desktop.m.sendkey([[0xffe7, 1], [0x72, 1], [0x72, 0], [0xffe7, 0]]); // Intel AMT: Meta-left down, 'r' press, 'r' release, Meta-left release
} else {
desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 0x5B], [desktop.m.KeyAction.DOWN, 82], [desktop.m.KeyAction.UP, 82], [desktop.m.KeyAction.EXUP, 0x5B]]); // MeshAgent: L-Winkey press, 'R' press, 'R' release, L-Winkey release
}
} else if (ks == 7) { // ALT-F4
if (desktop.contype == 2) {
desktop.m.sendkey([[0xffe9, 1], [0xffc1, 1], [0xffc1, 0], [0xffe9, 0]]); // Intel AMT: Alt down, 'F4' press, 'F4' release, Alt release
} else {
desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 18], [desktop.m.KeyAction.DOWN, 115], [desktop.m.KeyAction.UP, 115], [desktop.m.KeyAction.EXUP, 18]]); // MeshAgent: Alt press, 'F4' press, 'F4' release, Alt release
}
} else if (ks == 8) { // CTRL-W
if (desktop.contype == 2) {
desktop.m.sendkey([[0xffe3, 1], [0x77, 1], [0x77, 0], [0xffe3, 0]]); // Intel AMT: Ctrl down, 'w' press, 'w' release, Ctrl release
} else {
desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 17], [desktop.m.KeyAction.DOWN, 87], [desktop.m.KeyAction.UP, 87], [desktop.m.KeyAction.EXUP, 17]]); // MeshAgent: Ctrl press, 'W' press, 'W' release, Ctrl release
}
} else if (ks == 9) { // ALT-TAB
if (desktop.contype == 2) {
desktop.m.sendkey([[0xffe9, 1], [0xff09, 1], [0xff09, 0], [0xffe9, 0]]); // Intel AMT: Alt down, 'TAB' press, 'TAB' release, Alt release
} else {
desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.EXDOWN, 18], [desktop.m.KeyAction.DOWN, 9], [desktop.m.KeyAction.UP, 9], [desktop.m.KeyAction.EXUP, 18]]); // MeshAgent: Alt press, 'TAB' press, 'TAB' release, Alt release
}
} else if (ks == 10) { // CTRL-ALT-DEL
desktop.m.sendcad();
} else if (ks == 11) { // TAB
if (desktop.contype == 2) {
desktop.m.sendkey([[0xff09, 1], [0xff09, 0]]); // Intel AMT: 'TAB' press, 'TAB' release
} else {
desktop.m.SendKeyMsgKC([[desktop.m.KeyAction.DOWN, 9], [desktop.m.KeyAction.UP, 9]]); // MeshAgent: 'TAB' press, 'TAB' release
} }
} }
} }
*/
function sendSpecialKeys() {
if (xxdialogMode || desktop == null || desktop.State != 3) return;
setDialogMode(3, "Special Keys", 3, deskSendKeys);
}
// Send CTRL-ALT-DEL // Send CTRL-ALT-DEL
/*
function sendCAD() { function sendCAD() {
if (xxdialogMode || desktop == null || desktop.State != 3) return; if (xxdialogMode || desktop == null || desktop.State != 3) return;
desktop.m.sendcad(); desktop.m.sendcad();
} }
*/
// Toggle soft keyboard // Toggle soft keyboard
function toggleSoftKeys(x) { function toggleSoftKeys(x) {

View File

@ -33,7 +33,7 @@
<script keeplink=1 type="text/javascript" src="scripts/ol3-contextmenu.js"></script> <script keeplink=1 type="text/javascript" src="scripts/ol3-contextmenu.js"></script>
<title>{{{title}}}</title> <title>{{{title}}}</title>
</head> </head>
<body id="body" onload="if (typeof(startup) !== 'undefined') startup();" oncontextmenu="handleContextMenu(event)" style="display:none"> <body id="body" onload="if (typeof(startup) !== 'undefined') startup();" oncontextmenu="handleContextMenu(event)" style="display:none;min-width:495px">
<!-- right click menu --> <!-- right click menu -->
<div id="contextMenu" class="contextMenu noselect" style="display:none"> <div id="contextMenu" class="contextMenu noselect" style="display:none">
<div id="cxinfo" class="cmtext" onclick="cmaction(1,event)"><b>Information</b></div> <div id="cxinfo" class="cmtext" onclick="cmaction(1,event)"><b>Information</b></div>
@ -6626,15 +6626,24 @@
meshserver.send({ action: 'editmesh', meshid: currentMesh._id, flags: flags }); meshserver.send({ action: 'editmesh', meshid: currentMesh._id, flags: flags });
} }
function p20showAddMeshUserDialog() { function p20showAddMeshUserDialog(userid) {
if (xxdialogMode) return false; if (xxdialogMode) return false;
var x = "Allow users to manage this device group and devices in this group."; var x = '';
if (userid == null) {
x += "Allow users to manage this device group and devices in this group.";
if (features & 0x00080000) { x += " Users need to login to this server once before they can be added to a device group." } if (features & 0x00080000) { x += " Users need to login to this server once before they can be added to a device group." }
x += "<br /><br /><div style='position:relative'>"; x += "<br /><br /><div style='position:relative'>";
x += addHtmlValue('User Names', '<input id=dp20username style=width:230px maxlength=32 onchange=p20validateAddMeshUserDialog() onkeyup=p20validateAddMeshUserDialog() placeholder="user1, user2, user3" />'); x += addHtmlValue('User Names', '<input id=dp20username style=width:230px maxlength=32 onchange=p20validateAddMeshUserDialog() onkeyup=p20validateAddMeshUserDialog() placeholder="user1, user2, user3" />');
x += "<div id=dp20usersuggest class=suggestionBox style='top:30px;left:130px;display:none'></div>"; x += "<div id=dp20usersuggest class=suggestionBox style='top:30px;left:130px;display:none'></div>";
x += '</div>'; x += '</div><br>';
x += '<br><div style="height:120px;overflow-y:scroll;border:1px solid gray">'; } else {
userid = decodeURIComponent(userid);
var uname = userid.split('/')[2];
if (users && users[userid]) { uname = users[userid].name; }
if (userinfo._id == userid) { uname = userinfo.name; }
x += "Group permissions for user " + uname + ".<br /><br />";
}
x += '<div style="height:120px;overflow-y:scroll;border:1px solid gray">';
x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20fulladmin>Full Administrator</label><br>'; x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20fulladmin>Full Administrator</label><br>';
x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editmesh>Edit Device Group</label><br>'; x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editmesh>Edit Device Group</label><br>';
x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20manageusers>Manage Device Group Users</label><br>'; x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20manageusers>Manage Device Group Users</label><br>';
@ -6650,9 +6659,33 @@
x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20wakedevices>Wake Devices</label><br>'; x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20wakedevices>Wake Devices</label><br>';
x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editnotes>Edit Device Notes</label><br>'; x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editnotes>Edit Device Notes</label><br>';
x += '</div>'; x += '</div>';
if (userid == null) {
setDialogMode(2, "Add Users to Device Group", 3, p20showAddMeshUserDialogEx, x); setDialogMode(2, "Add Users to Device Group", 3, p20showAddMeshUserDialogEx, x);
p20validateAddMeshUserDialog();
Q('dp20username').focus(); Q('dp20username').focus();
} else {
setDialogMode(2, "Edit User Device Group Permissions", 7, p20showAddMeshUserDialogEx, x, userid);
var cmeshrights = currentMesh.links[userinfo._id].rights, meshrights = currentMesh.links[userid].rights;
if (meshrights == 0xFFFFFFFF) {
Q('p20fulladmin').checked = true;
} else {
if (meshrights & 1) { Q('p20editmesh').checked = true; }
if (meshrights & 2) { Q('p20manageusers').checked = true; }
if (meshrights & 4) { Q('p20managecomputers').checked = true; }
if (meshrights & 8) {
Q('p20remotecontrol').checked = true;
if (meshrights & 256) { Q('p20remoteview').checked = true; }
if (meshrights & 512) { Q('p20remotelimitedinput').checked = true; }
if (meshrights & 1024) { Q('p20noterminal').checked = true; }
if (meshrights & 2048) { Q('p20nofiles').checked = true; }
if (meshrights & 4096) { Q('p20noamt').checked = true; }
}
if (meshrights & 16) { Q('p20meshagentconsole').checked = true; }
if (meshrights & 32) { Q('p20meshserverfiles').checked = true; }
if (meshrights & 64) { Q('p20wakedevices').checked = true; }
if (meshrights & 128) { Q('p20editnotes').checked = true; }
}
}
p20validateAddMeshUserDialog();
return false; return false;
} }
@ -6668,9 +6701,10 @@
function p20validateAddMeshUserDialog() { function p20validateAddMeshUserDialog() {
var meshrights = currentMesh.links[userinfo._id].rights; var meshrights = currentMesh.links[userinfo._id].rights;
var ok = true, xusers = Q('dp20username').value.split(','); var ok = true, xusers = null;
if (Q('dp20username')) {
Q('dp20username').value.split(',');
for (var i in xusers) { var xuser = xusers[i] = xusers[i].trim(); if (xuser.length == 0) { ok = false; } else if (xuser.indexOf('"') >= 0) { ok = false; } } for (var i in xusers) { var xuser = xusers[i] = xusers[i].trim(); if (xuser.length == 0) { ok = false; } else if (xuser.indexOf('"') >= 0) { ok = false; } }
QE('idx_dlgOkButton', ok);
// Fill the suggestion box // Fill the suggestion box
var showsuggestbox = false, exactMatch = false; var showsuggestbox = false, exactMatch = false;
@ -6690,6 +6724,8 @@
} }
} }
QV('dp20usersuggest', showsuggestbox); QV('dp20usersuggest', showsuggestbox);
}
QE('idx_dlgOkButton', ok);
QE('p20fulladmin', meshrights == 0xFFFFFFFF); QE('p20fulladmin', meshrights == 0xFFFFFFFF);
QE('p20editmesh', (!Q('p20fulladmin').checked) && (meshrights == 0xFFFFFFFF)); QE('p20editmesh', (!Q('p20fulladmin').checked) && (meshrights == 0xFFFFFFFF));
@ -6707,7 +6743,10 @@
QE('p20noamt', !Q('p20fulladmin').checked && Q('p20remotecontrol').checked); QE('p20noamt', !Q('p20fulladmin').checked && Q('p20remotecontrol').checked);
} }
function p20showAddMeshUserDialogEx() { function p20showAddMeshUserDialogEx(b, t) {
if (b == 2) {
p20viewuserEx(b, t);
} else {
var meshadmin = 0; var meshadmin = 0;
if (Q('p20fulladmin').checked == true) { meshadmin = 0xFFFFFFFF; } else { if (Q('p20fulladmin').checked == true) { meshadmin = 0xFFFFFFFF; } else {
if (Q('p20editmesh').checked == true) meshadmin += 1; if (Q('p20editmesh').checked == true) meshadmin += 1;
@ -6725,15 +6764,24 @@
if (Q('p20remotelimitedinput').checked == true) meshadmin += 4096; if (Q('p20remotelimitedinput').checked == true) meshadmin += 4096;
} }
if (t == null) {
var users = Q('dp20username').value.split(','), users2 = []; var users = Q('dp20username').value.split(','), users2 = [];
for (var i in users) { users2.push(users[i].trim()); } for (var i in users) { users2.push(users[i].trim()); }
meshserver.send({ action: 'addmeshuser', meshid: currentMesh._id, meshname: currentMesh.name, usernames: users2, meshadmin: meshadmin }); meshserver.send({ action: 'addmeshuser', meshid: currentMesh._id, meshname: currentMesh.name, usernames: users2, meshadmin: meshadmin });
} else {
meshserver.send({ action: 'addmeshuser', meshid: currentMesh._id, meshname: currentMesh.name, usernames: [ t.split('/')[2] ], meshadmin: meshadmin });
}
}
} }
function p20viewuser(userid) { function p20viewuser(userid) {
if (xxdialogMode) return; if (xxdialogMode) return;
userid = decodeURIComponent(userid); var xuserid = decodeURIComponent(userid);
var r = '', cmeshrights = currentMesh.links[userinfo._id].rights, meshrights = currentMesh.links[userid].rights; var cmeshrights = currentMesh.links[userinfo._id].rights, meshrights = currentMesh.links[xuserid].rights;
if (((userinfo._id) != xuserid) && (cmeshrights == 0xFFFFFFFF || (((cmeshrights & 2) != 0) && (meshrights != 0xFFFFFFFF)))) {
p20showAddMeshUserDialog(userid);
} else {
var r = ''
if (meshrights == 0xFFFFFFFF) r = ', Full Administrator (all rights)'; else { if (meshrights == 0xFFFFFFFF) r = ', Full Administrator (all rights)'; else {
if ((meshrights & 1) != 0) r += ', Edit Device Group'; if ((meshrights & 1) != 0) r += ', Edit Device Group';
if ((meshrights & 2) != 0) r += ', Manage Device Group Users'; if ((meshrights & 2) != 0) r += ', Manage Device Group Users';
@ -6751,15 +6799,16 @@
} }
r = r.substring(2); r = r.substring(2);
if (r == '') { r = 'No Rights'; } if (r == '') { r = 'No Rights'; }
var uname = userid.split('/')[2]; var uname = xuserid.split('/')[2];
if (users && users[userid]) { uname = users[userid].name; } if (users && users[xuserid]) { uname = users[xuserid].name; }
if (userinfo._id == userid) { uname = userinfo.name; } if (userinfo._id == xuserid) { uname = userinfo.name; }
var buttons = 1, x = addHtmlValue('User Name', EscapeHtml(decodeURIComponent(uname))); var buttons = 1, x = addHtmlValue('User Name', EscapeHtml(decodeURIComponent(uname)));
if (userid.split('/')[2] != uname) { x += addHtmlValue('User Identifier', EscapeHtml(userid.split('/')[2])); } if (xuserid.split('/')[2] != uname) { x += addHtmlValue('User Identifier', EscapeHtml(xuserid.split('/')[2])); }
x += addHtmlValue('Permissions', r); x += addHtmlValue('Permissions', r);
if (((userinfo._id) != userid) && (cmeshrights == 0xFFFFFFFF || (((cmeshrights & 2) != 0) && (meshrights != 0xFFFFFFFF)))) buttons += 4; if (((userinfo._id) != xuserid) && (cmeshrights == 0xFFFFFFFF || (((cmeshrights & 2) != 0) && (meshrights != 0xFFFFFFFF)))) buttons += 4;
setDialogMode(2, "Device Group User", buttons, p20viewuserEx, x, userid); setDialogMode(2, "Device Group User", buttons, p20viewuserEx, x, xuserid);
}
} }
function p20viewuserEx(button, userid) { function p20viewuserEx(button, userid) {