mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-22 21:31:35 +03:00
Fixed user interface issues and added newAccountsRights in domain config.
This commit is contained in:
parent
252c5e51b8
commit
f4867f2349
@ -563,6 +563,25 @@ function CreateMeshCentralServer(config, args) {
|
||||
return;
|
||||
}
|
||||
if ((obj.config.domains[i].auth == 'ldap') || (obj.config.domains[i].auth == 'sspi')) { obj.config.domains[i].newaccounts = 0; } // No new accounts allowed in SSPI/LDAP authentication modes.
|
||||
|
||||
// Convert newAccountsRights from a array of strings to flags number.
|
||||
if (obj.config.domains[i].newaccountsrights && Array.isArray(obj.config.domains[i].newaccountsrights)) {
|
||||
var newAccRights = 0;
|
||||
for (var j in obj.config.domains[i].newaccountsrights) {
|
||||
var r = obj.config.domains[i].newaccountsrights[j].toLowerCase();
|
||||
if (r == 'fulladmin') { newAccRights = 0xFFFFFFFF; }
|
||||
if (r == 'serverbackup') { newAccRights |= 1; }
|
||||
if (r == 'manageusers') { newAccRights |= 2; }
|
||||
if (r == 'serverrestore') { newAccRights |= 4; }
|
||||
if (r == 'fileaccess') { newAccRights |= 8; }
|
||||
if (r == 'serverupdate') { newAccRights |= 16; }
|
||||
if (r == 'locked') { newAccRights |= 32; }
|
||||
if (r == 'nonewgroups') { newAccRights |= 64; }
|
||||
if (r == 'notools') { newAccRights |= 128; }
|
||||
}
|
||||
obj.config.domains[i].newaccountsrights = newAccRights;
|
||||
}
|
||||
if (obj.config.domains[i].newaccountsrights && (typeof (obj.config.domains[i].newaccountsrights) != 'number')) { delete obj.config.domains[i].newaccountsrights; }
|
||||
}
|
||||
|
||||
// Log passed arguments into Windows Service Log
|
||||
|
@ -981,6 +981,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
} else {
|
||||
// Check if this is an existing user
|
||||
var newuser = { type: 'user', _id: newuserid, name: newusername, creation: Math.floor(Date.now() / 1000), domain: domain.id };
|
||||
if (domain.newaccountsrights) { newuser.siteadmin = domain.newaccountsrights; }
|
||||
if (command.email != null) { newuser.email = command.email; } // Email
|
||||
if (command.resetNextLogin === true) { newuser.passchange = -1; } else { newuser.passchange = Math.floor(Date.now() / 1000); }
|
||||
if ((user.groups != null) && (user.groups.length > 0)) { newuser.groups = user.groups; } // New account are automatically part of our groups.
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "meshcentral",
|
||||
"version": "0.3.4-c",
|
||||
"version": "0.3.4-e",
|
||||
"keywords": [
|
||||
"Remote Management",
|
||||
"Intel AMT",
|
||||
|
@ -344,6 +344,10 @@ body {
|
||||
width:50%;
|
||||
}
|
||||
|
||||
.night #logincell a {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
#loginpanel, #createpanel, #resetpanel, #tokenpanel, #resettokenpanel, #resetpasswordpanel, #resetpasswordpanel {
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
@ -1844,6 +1848,10 @@ a {
|
||||
max-height: 200px;
|
||||
}
|
||||
|
||||
.night .notifiyBox {
|
||||
color: black;
|
||||
}
|
||||
|
||||
.notifiyBox:before {
|
||||
content: ' ';
|
||||
position: absolute;
|
||||
@ -1886,6 +1894,9 @@ a {
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.night #notificationCount {
|
||||
color: black;
|
||||
}
|
||||
|
||||
.deskareaicon {
|
||||
cursor: pointer;
|
||||
|
@ -47,6 +47,7 @@
|
||||
"_MeshQuota": 248576,
|
||||
"_NewAccounts": true,
|
||||
"_NewAccountEmailDomains": [ "sample.com" ],
|
||||
"_NewAccountsRights": [ "nonewgroups", "notools" ],
|
||||
"Footer": "<a href='https://twitter.com/mytwitter'>Twitter</a>",
|
||||
"_CertUrl": "https://192.168.2.106:443/",
|
||||
"_PasswordRequirements": { "min": 8, "max": 128, "upper": 1, "lower": 1, "numeric": 1, "nonalpha": 1, "reset": 90, "force2factor": true },
|
||||
|
File diff suppressed because one or more lines are too long
@ -6958,7 +6958,7 @@
|
||||
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_manageusers>Manage Users<br>';
|
||||
x += '<hr/><input type=checkbox onchange=showUserAdminDialogValidate() id=ua_lockedaccount>Lock Account<br>';
|
||||
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_nonewgroups>No New Device Groups<br>';
|
||||
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_nomeshcmd>No MeshCmd<br>';
|
||||
x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_nomeshcmd>No Tools (MeshCmd/Router)<br>';
|
||||
x += '</div>';
|
||||
var user = users[userid.toLowerCase()];
|
||||
setDialogMode(2, "Server Permissions", 3, showUserAdminDialogEx, x, user);
|
||||
@ -6971,7 +6971,7 @@
|
||||
Q('ua_serverupdate').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 16) != 0)); // Server Update
|
||||
Q('ua_lockedaccount').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 32) != 0)); // Account locked
|
||||
Q('ua_nonewgroups').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 64) != 0)); // No New Groups
|
||||
Q('ua_nomeshcmd').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 128) != 0)); // No MeshCmd
|
||||
Q('ua_nomeshcmd').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 128) != 0)); // No Tools (MeshCMD / Router)
|
||||
}
|
||||
QE('ua_fulladmin', userinfo.siteadmin == 0xFFFFFFFF);
|
||||
QE('ua_serverbackup', userinfo.siteadmin == 0xFFFFFFFF);
|
||||
@ -7473,12 +7473,13 @@
|
||||
// If web notifications are granted, use it.
|
||||
var notification = null;
|
||||
if (Notification && (Notification.permission == "granted")) {
|
||||
var text = n.text.split('®').join(''); // Clean up any HTML codes
|
||||
if (n.nodeid) {
|
||||
var node = getNodeFromId(n.nodeid);
|
||||
if (node) { notification = new Notification("{{{title}}} - " + node.name, { tag: n.tag, body: n.text, icon: '/images/notify/icons128-' + node.icon + '.png' }); }
|
||||
if (node) { notification = new Notification("{{{title}}} - " + node.name, { tag: n.tag, body: text, icon: '/images/notify/icons128-' + node.icon + '.png' }); }
|
||||
} else {
|
||||
if (n.icon == null) { n.icon = 0; }
|
||||
notification = new Notification("{{{title}}} - " + n.title, { tag: n.tag, body: n.text, icon: '/images/notify/icons128-' + n.icon + '.png' });
|
||||
notification = new Notification("{{{title}}} - " + n.title, { tag: n.tag, body: text, icon: '/images/notify/icons128-' + n.icon + '.png' });
|
||||
}
|
||||
notification.id = n.id;
|
||||
notification.xtag = n.tag;
|
||||
|
File diff suppressed because one or more lines are too long
@ -669,11 +669,10 @@
|
||||
|
||||
function center() {
|
||||
/* Now we use CSS media to achive the same effect as deleted JS */
|
||||
|
||||
if (webPageFullScreen == false) {
|
||||
QS('centralTable')['margin-top'] = '';
|
||||
} else {
|
||||
var h = (Q('column_l').clientHeight / 2) - 250;
|
||||
var h = ((Q('column_l').clientHeight) / 2) - 220;
|
||||
if (h < 0) h = 0;
|
||||
QS('centralTable')['margin-top'] = h + 'px';
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -299,6 +299,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||
if (user == null) {
|
||||
// Create a new user
|
||||
var user = { type: 'user', _id: userid, name: username, creation: Math.floor(Date.now() / 1000), login: Math.floor(Date.now() / 1000), domain: domain.id };
|
||||
if (domain.newaccountsrights) { user.siteadmin = domain.newaccountsrights; }
|
||||
var usercount = 0;
|
||||
for (var i in obj.users) { if (obj.users[i].domain == domain.id) { usercount++; } }
|
||||
if (usercount == 0) { user.siteadmin = 0xFFFFFFFF; /*if (domain.newaccounts === 2) { delete domain.newaccounts; }*/ } // If this is the first user, give the account site admin.
|
||||
@ -350,6 +351,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||
if (user == null) {
|
||||
// This user does not exist, create a new account.
|
||||
var user = { type: 'user', _id: userid, name: shortname, creation: Math.floor(Date.now() / 1000), login: Math.floor(Date.now() / 1000), domain: domain.id };
|
||||
if (domain.newaccountsrights) { user.siteadmin = domain.newaccountsrights; }
|
||||
var usercount = 0;
|
||||
for (var i in obj.users) { if (obj.users[i].domain == domain.id) { usercount++; } }
|
||||
if (usercount == 0) { user.siteadmin = 0xFFFFFFFF; /*if (domain.newaccounts === 2) { delete domain.newaccounts; }*/ } // If this is the first user, give the account site admin.
|
||||
@ -835,6 +837,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||
req.session.error = '<b style=color:#8C001A>Username already exists.</b>';
|
||||
} else {
|
||||
var user = { type: 'user', _id: 'user/' + domain.id + '/' + req.body.username.toLowerCase(), name: req.body.username, email: req.body.email, creation: Math.floor(Date.now() / 1000), login: Math.floor(Date.now() / 1000), domain: domain.id };
|
||||
if (domain.newaccountsrights) { user.siteadmin = domain.newaccountsrights; }
|
||||
if ((domain.passwordrequirements != null) && (domain.passwordrequirements.hint === true) && (req.body.apasswordhint)) { var hint = req.body.apasswordhint; if (hint.length > 250) { hint = hint.substring(0, 250); } user.passhint = hint; }
|
||||
if (domainUserCount == 0) { user.siteadmin = 0xFFFFFFFF; /*if (domain.newaccounts === 2) { delete domain.newaccounts; }*/ } // If this is the first user, give the account site admin.
|
||||
obj.users[user._id] = user;
|
||||
@ -1265,6 +1268,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||
if ((user == null) || (user.sid != req.session.usersid)) {
|
||||
// Create the domain user
|
||||
var usercount = 0, user2 = { type: 'user', _id: req.session.userid, name: req.connection.user, domain: domain.id, sid: req.session.usersid, creation: Math.floor(Date.now() / 1000), login: Math.floor(Date.now() / 1000) };
|
||||
if (domain.newaccountsrights) { user2.siteadmin = domain.newaccountsrights; }
|
||||
for (var i in obj.users) { if (obj.users[i].domain == domain.id) { usercount++; } }
|
||||
if (usercount == 0) { user2.siteadmin = 0xFFFFFFFF; } // If this is the first user, give the account site admin.
|
||||
obj.users[req.session.userid] = user2;
|
||||
|
Loading…
Reference in New Issue
Block a user