mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-09-11 08:55:32 +03:00
Fixed mtype not being a number type in database.
This commit is contained in:
parent
8fc23995b9
commit
0769185831
9
db.js
9
db.js
@ -101,7 +101,14 @@ module.exports.CreateDB = function (parent, func) {
|
||||
obj.GetAllType('mesh', function (err, docs) {
|
||||
if (err != null) { parent.debug('db', 'ERROR (GetAll mesh): ' + err); }
|
||||
var meshlist = [];
|
||||
if ((err == null) && (docs.length > 0)) { for (var i in docs) { meshlist.push(docs[i]._id); } }
|
||||
if ((err == null) && (docs.length > 0)) {
|
||||
for (var i in docs) {
|
||||
meshlist.push(docs[i]._id);
|
||||
|
||||
// Make sure all mesh types are number type, if not, fix it.
|
||||
if (typeof docs[i].mtype == 'string') { docs[i].mtype = parseInt(docs[i].mtype); obj.Set(docs[i]); }
|
||||
}
|
||||
}
|
||||
if ((obj.databaseType == 4) || (obj.databaseType == 5)) {
|
||||
// MariaDB
|
||||
sqlDbQuery('DELETE FROM MeshCentral.Main WHERE (extra LIKE ("mesh/%") AND (extra NOT IN ?)', [meshlist], func);
|
||||
|
@ -2765,6 +2765,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
}
|
||||
case 'createmesh':
|
||||
{
|
||||
console.log(command);
|
||||
|
||||
var err = null;
|
||||
try {
|
||||
// Check if we have new group restriction
|
||||
@ -2776,7 +2778,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
// Create mesh
|
||||
else if (common.validateString(command.meshname, 1, 128) == false) { err = 'Invalid group name'; } // Meshname is between 1 and 64 characters
|
||||
else if ((command.desc != null) && (common.validateString(command.desc, 0, 1024) == false)) { err = 'Invalid group description'; } // Mesh description is between 0 and 1024 characters
|
||||
else if ((command.meshtype != 1) && (command.meshtype != 2)) { err = 'Invalid group type'; }
|
||||
else if ((command.meshtype !== 1) && (command.meshtype !== 2)) { err = 'Invalid group type'; }
|
||||
} catch (ex) { err = 'Validation exception: ' + ex; }
|
||||
|
||||
// Handle any errors
|
||||
|
@ -1790,7 +1790,7 @@
|
||||
}
|
||||
|
||||
function account_createMeshEx(button, tag) {
|
||||
meshserver.send({ action: 'createmesh', meshname: Q('dp3meshname').value, meshtype: Q('dp3meshtype').value, desc: Q('dp3meshdesc').value });
|
||||
meshserver.send({ action: 'createmesh', meshname: Q('dp3meshname').value, meshtype: parseInt(Q('dp3meshtype').value), desc: Q('dp3meshdesc').value });
|
||||
}
|
||||
|
||||
function account_validateDeleteAccount() {
|
||||
|
@ -9583,7 +9583,7 @@
|
||||
}
|
||||
|
||||
function account_createMeshEx(button, tag) {
|
||||
meshserver.send({ action: 'createmesh', meshname: Q('dp2meshname').value, meshtype: Q('dp2meshtype').value, desc: Q('dp2meshdesc').value });
|
||||
meshserver.send({ action: 'createmesh', meshname: Q('dp2meshname').value, meshtype: parseInt(Q('dp2meshtype').value), desc: Q('dp2meshdesc').value });
|
||||
}
|
||||
|
||||
function account_validateDeleteAccount() {
|
||||
|
Loading…
Reference in New Issue
Block a user