mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-26 07:05:52 -05:00
Factorize myserver upgrade check
This commit is contained in:
parent
27a4589306
commit
ccb9094217
13
meshuser.js
13
meshuser.js
@ -5644,10 +5644,9 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
|
|
||||||
function serverCommandServerErrors(command) {
|
function serverCommandServerErrors(command) {
|
||||||
// Load the server error log
|
// Load the server error log
|
||||||
if (userHasSiteUpdate() && domainHasMyServerErrorLog()) {
|
if (userHasSiteUpdate() && domainHasMyServerErrorLog())
|
||||||
fs.readFile(parent.parent.getConfigFilePath('mesherrors.txt'), 'utf8', function (err, data) { try { ws.send(JSON.stringify({ action: 'servererrors', data: data })); } catch (ex) { } });
|
fs.readFile(parent.parent.getConfigFilePath('mesherrors.txt'), 'utf8', function (err, data) { try { ws.send(JSON.stringify({ action: 'servererrors', data: data })); } catch (ex) { } });
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function serverCommandServerStats(command) {
|
function serverCommandServerStats(command) {
|
||||||
// Only accept if the "My Server" tab is allowed for this domain
|
// Only accept if the "My Server" tab is allowed for this domain
|
||||||
@ -5669,9 +5668,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
if (req.session.loginToken != null) return;
|
if (req.session.loginToken != null) return;
|
||||||
|
|
||||||
// Perform server update
|
// Perform server update
|
||||||
if (!userHasSiteUpdate()) return;
|
if (userHasSiteUpdate() && domainHasMyServerUpgrade() && !((command.version != null) && (typeof command.version != 'string')))
|
||||||
if ((domain.myserver === false) || ((domain.myserver != null) && (domain.myserver !== true) && (domain.myserver.upgrade !== true))) return;
|
|
||||||
if ((command.version != null) && (typeof command.version != 'string')) return;
|
|
||||||
parent.parent.performServerUpdate(command.version);
|
parent.parent.performServerUpdate(command.version);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5680,8 +5677,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
if (req.session.loginToken != null) return;
|
if (req.session.loginToken != null) return;
|
||||||
|
|
||||||
// Check the server version
|
// Check the server version
|
||||||
if (!userHasSiteUpdate()) return;
|
if (userHasSiteUpdate() && domainHasMyServerUpgrade())
|
||||||
if ((domain.myserver === false) || ((domain.myserver != null) && (domain.myserver !== true) && (domain.myserver.upgrade !== true))) return;
|
|
||||||
parent.parent.getServerTags(function (tags, err) { try { ws.send(JSON.stringify({ action: 'serverversion', tags: tags })); } catch (ex) { } });
|
parent.parent.getServerTags(function (tags, err) { try { ws.send(JSON.stringify({ action: 'serverversion', tags: tags })); } catch (ex) { } });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6287,7 +6283,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
}
|
}
|
||||||
|
|
||||||
function userHasSiteUpdate() { return ((user.siteadmin & SITERIGHT_SERVERUPDATE) > 0); }
|
function userHasSiteUpdate() { return ((user.siteadmin & SITERIGHT_SERVERUPDATE) > 0); }
|
||||||
function domainHasMyServerErrorLog() { return !((domain.myserver === false) || ((domain.myserver != null) && (domain.myserver !== true) && (domain.myserver.errorlog !== true))) }
|
function domainHasMyServerErrorLog() { return !((domain.myserver === false) || ((domain.myserver != null) && (domain.myserver !== true) && (domain.myserver.errorlog !== true))); }
|
||||||
|
function domainHasMyServerUpgrade() { return !((domain.myserver === false) || ((domain.myserver != null) && (domain.myserver !== true) && (domain.myserver.upgrade !== true))); }
|
||||||
|
|
||||||
function csvClean(s) { return '\"' + s.split('\"').join('').split(',').join('').split('\r').join('').split('\n').join('') + '\"'; }
|
function csvClean(s) { return '\"' + s.split('\"').join('').split(',').join('').split('\r').join('').split('\n').join('') + '\"'; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user