mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-24 06:05:53 -05:00
More user group improvements, translation improvements.
This commit is contained in:
parent
ee0c0f1021
commit
19b5c5663a
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "meshcentral",
|
"name": "meshcentral",
|
||||||
"version": "0.4.6-u",
|
"version": "0.4.6-v",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Remote Management",
|
"Remote Management",
|
||||||
"Intel AMT",
|
"Intel AMT",
|
||||||
|
@ -600,19 +600,19 @@ body {
|
|||||||
|
|
||||||
#idx_dlgCancelButton {
|
#idx_dlgCancelButton {
|
||||||
float: right;
|
float: right;
|
||||||
width: 80px;
|
min-width: 80px;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#idx_dlgOkButton {
|
#idx_dlgOkButton {
|
||||||
float: right;
|
float: right;
|
||||||
width: 80px;
|
min-width: 80px;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#idx_dlgDeleteButton {
|
#idx_dlgDeleteButton {
|
||||||
float: left;
|
float: left;
|
||||||
width: 80px;
|
min-width: 80px;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2693,7 +2693,7 @@
|
|||||||
"pt": "Cancelar",
|
"pt": "Cancelar",
|
||||||
"ja": "キャンセル",
|
"ja": "キャンセル",
|
||||||
"nl": "Annuleren",
|
"nl": "Annuleren",
|
||||||
"de": "Abbr.",
|
"de": "Abbrechen",
|
||||||
"xloc": [
|
"xloc": [
|
||||||
"default.handlebars->container->dialog->idx_dlgButtonBar",
|
"default.handlebars->container->dialog->idx_dlgButtonBar",
|
||||||
"default.handlebars->23->946",
|
"default.handlebars->23->946",
|
||||||
|
@ -1125,7 +1125,7 @@
|
|||||||
var meshes = {};
|
var meshes = {};
|
||||||
var meshcount = 0;
|
var meshcount = 0;
|
||||||
var nodes = null;
|
var nodes = null;
|
||||||
var usergroups = {};
|
var usergroups = null;
|
||||||
var filetree = {};
|
var filetree = {};
|
||||||
var userinfo = null;
|
var userinfo = null;
|
||||||
var serverinfo = null;
|
var serverinfo = null;
|
||||||
@ -1722,8 +1722,10 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'usergroups': {
|
case 'usergroups': {
|
||||||
|
var groupCount = 0;
|
||||||
usergroups = {};
|
usergroups = {};
|
||||||
for (var i in message.ugroups) { usergroups[message.ugroups[i]._id] = message.ugroups[i]; }
|
for (var i in message.ugroups) { groupCount++; usergroups[message.ugroups[i]._id] = message.ugroups[i]; }
|
||||||
|
if (groupCount == 0) { usergroups = null; }
|
||||||
masterUpdate(8192);
|
masterUpdate(8192);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2218,6 +2220,7 @@
|
|||||||
case 'createusergroup':
|
case 'createusergroup':
|
||||||
case 'usergroupchange': {
|
case 'usergroupchange': {
|
||||||
// User group changed
|
// User group changed
|
||||||
|
if (usergroups == null) { usergroups = {}; }
|
||||||
var ugroup = usergroups[message.event.ugrpid];
|
var ugroup = usergroups[message.event.ugrpid];
|
||||||
if (ugroup == null) {
|
if (ugroup == null) {
|
||||||
// This is a new user group for us
|
// This is a new user group for us
|
||||||
@ -2233,7 +2236,13 @@
|
|||||||
}
|
}
|
||||||
case 'deleteusergroup': {
|
case 'deleteusergroup': {
|
||||||
// User group removed
|
// User group removed
|
||||||
if (usergroups[message.event.ugrpid] != null) { delete usergroups[message.event.ugrpid]; masterUpdate(8192); }
|
if ((usergroups != null) && (usergroups[message.event.ugrpid] != null)) {
|
||||||
|
delete usergroups[message.event.ugrpid];
|
||||||
|
var c = 0;
|
||||||
|
for (var i in usergroups) { c++; }
|
||||||
|
if (c == 0) { usergroups = null; } // If user groups is empty, set it to null.
|
||||||
|
masterUpdate(8192 + 16384);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'createmesh': {
|
case 'createmesh': {
|
||||||
@ -7651,7 +7660,7 @@
|
|||||||
x += '<br style=clear:both><br>';
|
x += '<br style=clear:both><br>';
|
||||||
if (meshrights & 2) {
|
if (meshrights & 2) {
|
||||||
x += '<a href=# onclick="return p20showAddMeshUserDialog()" style=cursor:pointer;margin-right:10px><img src=images/icon-addnew.png border=0 height=12 width=12> ' + "Add Users" + '</a>';
|
x += '<a href=# onclick="return p20showAddMeshUserDialog()" style=cursor:pointer;margin-right:10px><img src=images/icon-addnew.png border=0 height=12 width=12> ' + "Add Users" + '</a>';
|
||||||
if ((userinfo.siteadmin & 256) != 0) {
|
if ((usergroups != null) && ((userinfo.siteadmin & 256) != 0)) {
|
||||||
var userGroupCount = 0, newUserGroup = false;
|
var userGroupCount = 0, newUserGroup = false;
|
||||||
for (var i in usergroups) { userGroupCount++; if ((currentMesh.links == null) || (currentMesh.links[i] == null)) { newUserGroup = true; } }
|
for (var i in usergroups) { userGroupCount++; if ((currentMesh.links == null) || (currentMesh.links[i] == null)) { newUserGroup = true; } }
|
||||||
if ((userGroupCount > 0) && (newUserGroup)) { x += '<a href=# onclick="return p20showAddMeshUserDialog(2)" style=cursor:pointer;margin-right:10px><img src=images/icon-addnew.png border=0 height=12 width=12> ' + "Add User Group" + '</a>'; }
|
if ((userGroupCount > 0) && (newUserGroup)) { x += '<a href=# onclick="return p20showAddMeshUserDialog(2)" style=cursor:pointer;margin-right:10px><img src=images/icon-addnew.png border=0 height=12 width=12> ' + "Add User Group" + '</a>'; }
|
||||||
@ -7682,6 +7691,7 @@
|
|||||||
var uname = i.split('/')[2];
|
var uname = i.split('/')[2];
|
||||||
if (currentMesh.links[i].name) { uname = currentMesh.links[i].name; }
|
if (currentMesh.links[i].name) { uname = currentMesh.links[i].name; }
|
||||||
if (i == userinfo._id) { uname = userinfo.name; }
|
if (i == userinfo._id) { uname = userinfo.name; }
|
||||||
|
if ((usergroups != null) && (usergroups[i] != null)) { uname = usergroups[i].name; }
|
||||||
sortedusers.push({ id: i, name: uname, rights: currentMesh.links[i].rights });
|
sortedusers.push({ id: i, name: uname, rights: currentMesh.links[i].rights });
|
||||||
}
|
}
|
||||||
sortedusers.sort(function(a, b) { if (a.name > b.name) return 1; if (a.name < b.name) return -1; return 0; });
|
sortedusers.sort(function(a, b) { if (a.name > b.name) return 1; if (a.name < b.name) return -1; return 0; });
|
||||||
@ -7888,7 +7898,7 @@
|
|||||||
for (var i in meshes) { if ((currentUser.links == null) || (currentUser.links[i] == null)) { y += '<option value=' + encodeURIComponent(i) + '>' + EscapeHtml(meshes[i].name) + '</option>'; } }
|
for (var i in meshes) { if ((currentUser.links == null) || (currentUser.links[i] == null)) { y += '<option value=' + encodeURIComponent(i) + '>' + EscapeHtml(meshes[i].name) + '</option>'; } }
|
||||||
x += addHtmlValue("Device Group", '<div style=width:230px;margin:0;padding:0><select onchange=p20validateAddMeshUserDialog() id=dp2groupid style=width:100%>' + y + '</select></div>');
|
x += addHtmlValue("Device Group", '<div style=width:230px;margin:0;padding:0><select onchange=p20validateAddMeshUserDialog() id=dp2groupid style=width:100%>' + y + '</select></div>');
|
||||||
} else if (userid === 2) {
|
} else if (userid === 2) {
|
||||||
if ((userinfo.siteadmin & 256) == 0) return;
|
if ((usergroups == null) || ((userinfo.siteadmin & 256) == 0)) return;
|
||||||
var y = '';
|
var y = '';
|
||||||
for (var i in usergroups) { if ((currentMesh.links == null) || (currentMesh.links[i] == null)) { y += '<option value=' + encodeURIComponent(i) + '>' + EscapeHtml(usergroups[i].name) + '</option>'; } }
|
for (var i in usergroups) { if ((currentMesh.links == null) || (currentMesh.links[i] == null)) { y += '<option value=' + encodeURIComponent(i) + '>' + EscapeHtml(usergroups[i].name) + '</option>'; } }
|
||||||
x += addHtmlValue("User Group", '<div style=width:230px;margin:0;padding:0><select onchange=p20validateAddMeshUserDialog() id=dp2groupid style=width:100%>' + y + '</select></div>');
|
x += addHtmlValue("User Group", '<div style=width:230px;margin:0;padding:0><select onchange=p20validateAddMeshUserDialog() id=dp2groupid style=width:100%>' + y + '</select></div>');
|
||||||
@ -9089,7 +9099,7 @@
|
|||||||
function updateUserGroups() {
|
function updateUserGroups() {
|
||||||
// Sort the list of group names
|
// Sort the list of group names
|
||||||
var sortedGroups = [], x = '';
|
var sortedGroups = [], x = '';
|
||||||
for (var i in usergroups) { sortedGroups.push(usergroups[i]); }
|
if (usergroups) { for (var i in usergroups) { sortedGroups.push(usergroups[i]); } }
|
||||||
sortedGroups.sort(nameSort);
|
sortedGroups.sort(nameSort);
|
||||||
|
|
||||||
if (sortedGroups.length == 0) {
|
if (sortedGroups.length == 0) {
|
||||||
@ -9124,7 +9134,7 @@
|
|||||||
if (xxdialogMode) return;
|
if (xxdialogMode) return;
|
||||||
var x = '', y = '';
|
var x = '', y = '';
|
||||||
if (mode == 2) {
|
if (mode == 2) {
|
||||||
for (var i in usergroups) { y += '<option value=' + encodeURIComponent(i) + '>' + EscapeHtml(usergroups[i].name) + '</option>'; }
|
if (usergroups) { for (var i in usergroups) { y += '<option value=' + encodeURIComponent(i) + '>' + EscapeHtml(usergroups[i].name) + '</option>'; } }
|
||||||
x += addHtmlValue("User Group", '<div style=width:230px;margin:0;padding:0><select id=dp4groupid style=width:100%>' + y + '</select></div>');
|
x += addHtmlValue("User Group", '<div style=width:230px;margin:0;padding:0><select id=dp4groupid style=width:100%>' + y + '</select></div>');
|
||||||
}
|
}
|
||||||
x += addHtmlValue("Name", '<input id=p4name maxlength=64 onchange=showCreateUserGroupDialogValidate() onkeyup=showCreateUserGroupDialogValidate() />');
|
x += addHtmlValue("Name", '<input id=p4name maxlength=64 onchange=showCreateUserGroupDialogValidate() onkeyup=showCreateUserGroupDialogValidate() />');
|
||||||
@ -9151,7 +9161,7 @@
|
|||||||
var currentUserGroup = null;
|
var currentUserGroup = null;
|
||||||
function gotoUserGroup(groupid, force) {
|
function gotoUserGroup(groupid, force) {
|
||||||
if (xxdialogMode && !force) return;
|
if (xxdialogMode && !force) return;
|
||||||
var group = currentUserGroup = usergroups[decodeURIComponent(groupid)];
|
var group = currentUserGroup = usergroups?usergroups[decodeURIComponent(groupid)]:null;
|
||||||
if (group == null) { if (xxcurrentView == 51) { setDialogMode(0); go(50); } return; }
|
if (group == null) { if (xxcurrentView == 51) { setDialogMode(0); go(50); } return; }
|
||||||
QH('p51groupName', group.name);
|
QH('p51groupName', group.name);
|
||||||
var usercount = 0, meshcount = 0;
|
var usercount = 0, meshcount = 0;
|
||||||
@ -9570,10 +9580,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count == 1) { x += '<tr><td><div style=padding:6px> <i>' + "No device groups in common" + '</i><div></div></div></td><td></td></tr>'; }
|
if (count == 1) { x += '<tr><td><div style=padding:6px> <i>' + "No device groups in common" + '</i><div></div></div></td><td></td></tr>'; }
|
||||||
x += '</tbody></table><br />';
|
x += '</tbody></table>';
|
||||||
|
|
||||||
if (usergroups != null) {
|
if (usergroups != null) {
|
||||||
count = 1;
|
count = 1;
|
||||||
|
x += '<br />';
|
||||||
if ((userinfo.siteadmin & 256) != 0) {
|
if ((userinfo.siteadmin & 256) != 0) {
|
||||||
var userGroupCount = 0, newUserGroup = false;
|
var userGroupCount = 0, newUserGroup = false;
|
||||||
for (var i in usergroups) { userGroupCount++; if ((currentUser.links == null) || (currentUser.links[i] == null)) { newUserGroup = true; } }
|
for (var i in usergroups) { userGroupCount++; if ((currentUser.links == null) || (currentUser.links[i] == null)) { newUserGroup = true; } }
|
||||||
@ -9598,7 +9609,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function p30RemoveUserGroup(button, ugrpid) {
|
function p30RemoveUserGroup(button, ugrpid) {
|
||||||
if (xxdialogMode) return;
|
if (xxdialogMode || (usergroups == null)) return;
|
||||||
var groupid = decodeURIComponent(ugrpid), group = usergroups[groupid];
|
var groupid = decodeURIComponent(ugrpid), group = usergroups[groupid];
|
||||||
var name = (group != null)?EscapeHtml(group.name):('<i>' + "Unknown" + '</i>');
|
var name = (group != null)?EscapeHtml(group.name):('<i>' + "Unknown" + '</i>');
|
||||||
setDialogMode(2, "Remove User", 3, p30RemoveUserGroupEx, format("Confirm removal of group {0}?", name), groupid);
|
setDialogMode(2, "Remove User", 3, p30RemoveUserGroupEx, format("Confirm removal of group {0}?", name), groupid);
|
||||||
@ -9609,7 +9620,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function p30showAddUserGroupDialog() {
|
function p30showAddUserGroupDialog() {
|
||||||
if (xxdialogMode) return;
|
if (xxdialogMode || (usergroups == null)) return;
|
||||||
var y = '';
|
var y = '';
|
||||||
for (var i in usergroups) { if ((currentUser.links == null) || (currentUser.links[i] == null)) { y += '<option value=' + encodeURIComponent(i) + '>' + EscapeHtml(usergroups[i].name) + '</option>'; } }
|
for (var i in usergroups) { if ((currentUser.links == null) || (currentUser.links[i] == null)) { y += '<option value=' + encodeURIComponent(i) + '>' + EscapeHtml(usergroups[i].name) + '</option>'; } }
|
||||||
var x = addHtmlValue("User Group", '<div style=width:230px;margin:0;padding:0><select id=dp2groupid style=width:100%>' + y + '</select></div>');
|
var x = addHtmlValue("User Group", '<div style=width:230px;margin:0;padding:0><select id=dp2groupid style=width:100%>' + y + '</select></div>');
|
||||||
|
@ -4165,7 +4165,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
|||||||
function render(req, res, filename, args) {
|
function render(req, res, filename, args) {
|
||||||
if ((obj.parent.webViewsOverridePath == null) && (obj.renderPages != null)) {
|
if ((obj.parent.webViewsOverridePath == null) && (obj.renderPages != null)) {
|
||||||
// If a user set a localization, use that
|
// If a user set a localization, use that
|
||||||
if ((req.session != null) && (req.session.userid)) {
|
if ((req.query.lang == null) && (req.session != null) && (req.session.userid)) {
|
||||||
var user = obj.users[req.session.userid];
|
var user = obj.users[req.session.userid];
|
||||||
if ((user != null) && (user.lang != null)) { req.query.lang = user.lang; }
|
if ((user != null) && (user.lang != null)) { req.query.lang = user.lang; }
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user