mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-09-11 08:55:32 +03:00
More user group improvements, translation improvements.
This commit is contained in:
parent
ee0c0f1021
commit
19b5c5663a
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "meshcentral",
|
||||
"version": "0.4.6-u",
|
||||
"version": "0.4.6-v",
|
||||
"keywords": [
|
||||
"Remote Management",
|
||||
"Intel AMT",
|
||||
|
@ -600,19 +600,19 @@ body {
|
||||
|
||||
#idx_dlgCancelButton {
|
||||
float: right;
|
||||
width: 80px;
|
||||
min-width: 80px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
#idx_dlgOkButton {
|
||||
float: right;
|
||||
width: 80px;
|
||||
min-width: 80px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
#idx_dlgDeleteButton {
|
||||
float: left;
|
||||
width: 80px;
|
||||
min-width: 80px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
|
@ -2693,7 +2693,7 @@
|
||||
"pt": "Cancelar",
|
||||
"ja": "キャンセル",
|
||||
"nl": "Annuleren",
|
||||
"de": "Abbr.",
|
||||
"de": "Abbrechen",
|
||||
"xloc": [
|
||||
"default.handlebars->container->dialog->idx_dlgButtonBar",
|
||||
"default.handlebars->23->946",
|
||||
|
@ -1125,7 +1125,7 @@
|
||||
var meshes = {};
|
||||
var meshcount = 0;
|
||||
var nodes = null;
|
||||
var usergroups = {};
|
||||
var usergroups = null;
|
||||
var filetree = {};
|
||||
var userinfo = null;
|
||||
var serverinfo = null;
|
||||
@ -1722,8 +1722,10 @@
|
||||
break;
|
||||
}
|
||||
case 'usergroups': {
|
||||
var groupCount = 0;
|
||||
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);
|
||||
break;
|
||||
}
|
||||
@ -2218,6 +2220,7 @@
|
||||
case 'createusergroup':
|
||||
case 'usergroupchange': {
|
||||
// User group changed
|
||||
if (usergroups == null) { usergroups = {}; }
|
||||
var ugroup = usergroups[message.event.ugrpid];
|
||||
if (ugroup == null) {
|
||||
// This is a new user group for us
|
||||
@ -2233,7 +2236,13 @@
|
||||
}
|
||||
case 'deleteusergroup': {
|
||||
// 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;
|
||||
}
|
||||
case 'createmesh': {
|
||||
@ -7651,7 +7660,7 @@
|
||||
x += '<br style=clear:both><br>';
|
||||
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>';
|
||||
if ((userinfo.siteadmin & 256) != 0) {
|
||||
if ((usergroups != null) && ((userinfo.siteadmin & 256) != 0)) {
|
||||
var userGroupCount = 0, newUserGroup = false;
|
||||
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>'; }
|
||||
@ -7682,6 +7691,7 @@
|
||||
var uname = i.split('/')[2];
|
||||
if (currentMesh.links[i].name) { uname = currentMesh.links[i].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.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>'; } }
|
||||
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) {
|
||||
if ((userinfo.siteadmin & 256) == 0) return;
|
||||
if ((usergroups == null) || ((userinfo.siteadmin & 256) == 0)) return;
|
||||
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>'; } }
|
||||
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() {
|
||||
// Sort the list of group names
|
||||
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);
|
||||
|
||||
if (sortedGroups.length == 0) {
|
||||
@ -9124,7 +9134,7 @@
|
||||
if (xxdialogMode) return;
|
||||
var x = '', y = '';
|
||||
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("Name", '<input id=p4name maxlength=64 onchange=showCreateUserGroupDialogValidate() onkeyup=showCreateUserGroupDialogValidate() />');
|
||||
@ -9151,7 +9161,7 @@
|
||||
var currentUserGroup = null;
|
||||
function gotoUserGroup(groupid, force) {
|
||||
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; }
|
||||
QH('p51groupName', group.name);
|
||||
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>'; }
|
||||
x += '</tbody></table><br />';
|
||||
x += '</tbody></table>';
|
||||
|
||||
if (usergroups != null) {
|
||||
count = 1;
|
||||
x += '<br />';
|
||||
if ((userinfo.siteadmin & 256) != 0) {
|
||||
var userGroupCount = 0, newUserGroup = false;
|
||||
for (var i in usergroups) { userGroupCount++; if ((currentUser.links == null) || (currentUser.links[i] == null)) { newUserGroup = true; } }
|
||||
@ -9598,7 +9609,7 @@
|
||||
}
|
||||
|
||||
function p30RemoveUserGroup(button, ugrpid) {
|
||||
if (xxdialogMode) return;
|
||||
if (xxdialogMode || (usergroups == null)) return;
|
||||
var groupid = decodeURIComponent(ugrpid), group = usergroups[groupid];
|
||||
var name = (group != null)?EscapeHtml(group.name):('<i>' + "Unknown" + '</i>');
|
||||
setDialogMode(2, "Remove User", 3, p30RemoveUserGroupEx, format("Confirm removal of group {0}?", name), groupid);
|
||||
@ -9609,7 +9620,7 @@
|
||||
}
|
||||
|
||||
function p30showAddUserGroupDialog() {
|
||||
if (xxdialogMode) return;
|
||||
if (xxdialogMode || (usergroups == null)) return;
|
||||
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>'; } }
|
||||
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) {
|
||||
if ((obj.parent.webViewsOverridePath == null) && (obj.renderPages != null)) {
|
||||
// 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];
|
||||
if ((user != null) && (user.lang != null)) { req.query.lang = user.lang; }
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user