Added User Web State control on config.json.
This commit is contained in:
parent
b85e7495a7
commit
152a942ccc
|
@ -541,7 +541,7 @@ function CreateMeshCentralServer(config, args) {
|
|||
|
||||
// Lower case all keys in the config file
|
||||
try {
|
||||
require('./common.js').objKeysToLower(config2, ["ldapoptions"]);
|
||||
require('./common.js').objKeysToLower(config2, ['ldapoptions', 'defaultuserwebstate', 'forceduserwebstate']);
|
||||
} catch (ex) {
|
||||
console.log('CRITICAL ERROR: Unable to access the file \"./common.js\".\r\nCheck folder & file permissions.');
|
||||
process.exit();
|
||||
|
@ -830,7 +830,7 @@ function CreateMeshCentralServer(config, args) {
|
|||
|
||||
// Lower case all keys in the config file
|
||||
try {
|
||||
require('./common.js').objKeysToLower(config2, ['ldapoptions']);
|
||||
require('./common.js').objKeysToLower(config2, ['ldapoptions', 'defaultuserwebstate', 'forceduserwebstate']);
|
||||
} catch (ex) {
|
||||
console.log("CRITICAL ERROR: Unable to access the file \"./common.js\".\r\nCheck folder & file permissions.");
|
||||
process.exit();
|
||||
|
@ -2266,7 +2266,7 @@ function getConfig(createSampleConfig) {
|
|||
|
||||
// Lower case all keys in the config file
|
||||
try {
|
||||
require('./common.js').objKeysToLower(config, ["ldapoptions"]);
|
||||
require('./common.js').objKeysToLower(config, ['ldapoptions', 'defaultuserwebstate', 'forceduserwebstate']);
|
||||
} catch (ex) {
|
||||
console.log('CRITICAL ERROR: Unable to access the file \"./common.js\".\r\nCheck folder & file permissions.');
|
||||
process.exit();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "meshcentral",
|
||||
"version": "0.4.9-m",
|
||||
"version": "0.4.9-n",
|
||||
"keywords": [
|
||||
"Remote Management",
|
||||
"Intel AMT",
|
||||
|
|
|
@ -3636,7 +3636,7 @@
|
|||
"pt": "Erro de chamada",
|
||||
"ru": "Ошибка вызова",
|
||||
"xloc": [
|
||||
"default.handlebars->27->1480"
|
||||
"default.handlebars->27->1477"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -8824,10 +8824,7 @@
|
|||
},
|
||||
{
|
||||
"en": "Illegal invocation",
|
||||
"nl": "Ongeldige aanroep",
|
||||
"xloc": [
|
||||
"default.handlebars->27->1478"
|
||||
]
|
||||
"nl": "Ongeldige aanroep"
|
||||
},
|
||||
{
|
||||
"cs": "Kódovaní obrazu",
|
||||
|
@ -10393,7 +10390,7 @@
|
|||
"pt": "Menos",
|
||||
"ru": "Меньше",
|
||||
"xloc": [
|
||||
"default.handlebars->27->1482"
|
||||
"default.handlebars->27->1479"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -12016,7 +12013,7 @@
|
|||
"pt": "Mais",
|
||||
"ru": "Еще",
|
||||
"xloc": [
|
||||
"default.handlebars->27->1481"
|
||||
"default.handlebars->27->1478"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -20615,10 +20612,7 @@
|
|||
},
|
||||
{
|
||||
"en": "encoding",
|
||||
"nl": "codering",
|
||||
"xloc": [
|
||||
"default.handlebars->27->1477"
|
||||
]
|
||||
"nl": "codering"
|
||||
},
|
||||
{
|
||||
"cs": "eventslist.csv",
|
||||
|
@ -21001,10 +20995,7 @@
|
|||
},
|
||||
{
|
||||
"en": "undefined",
|
||||
"nl": "onbepaald",
|
||||
"xloc": [
|
||||
"default.handlebars->27->1479"
|
||||
]
|
||||
"nl": "onbepaald"
|
||||
},
|
||||
{
|
||||
"cs": "uživatel:",
|
||||
|
|
|
@ -1128,6 +1128,7 @@
|
|||
var webState = '{{{webstate}}}';
|
||||
if (webState != '') { webState = JSON.parse(decodeURIComponent(webState)); }
|
||||
for (var i in webState) { localStorage.setItem(i, webState[i]); }
|
||||
if (webState.deviceView != null) { localStorage.setItem('_deviceView', webState.deviceView); }
|
||||
if (!webState.loctag) { try { delete localStorage.removeItem('loctag'); } catch (ex) { } }
|
||||
|
||||
var args, urlargs;
|
||||
|
|
|
@ -1590,6 +1590,13 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
|||
parent.debug('web', 'handleRootRequestEx: success.');
|
||||
obj.db.Get('ws' + user._id, function (err, states) {
|
||||
var webstate = (states.length == 1) ? obj.filterUserWebState(states[0].state) : '';
|
||||
if ((webstate == '') && (typeof domain.defaultuserwebstate == 'object')) { webstate = JSON.stringify(domain.defaultuserwebstate); } // User has no web state, use defaults.
|
||||
if (typeof domain.forceduserwebstate == 'object') { // Forces initial user web state is present, use it.
|
||||
var webstate2 = {};
|
||||
try { if (webstate != '') { webstate2 = JSON.parse(webstate); } } catch (ex) { }
|
||||
for (var i in domain.forceduserwebstate) { webstate2[i] = domain.forceduserwebstate[i]; }
|
||||
webstate = JSON.stringify(webstate2);
|
||||
}
|
||||
render(req, res, getRenderPage('default', req), getRenderArgs({ authCookie: authCookie, authRelayCookie: authRelayCookie, viewmode: viewmode, currentNode: currentNode, logoutControls: JSON.stringify(logoutcontrols), domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: obj.getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, sessiontime: args.sessiontime, mpspass: args.mpspass, passRequirements: passRequirements, webcerthash: Buffer.from(obj.webCertificateFullHashs[domain.id], 'binary').toString('base64').replace(/\+/g, '@').replace(/\//g, '$'), footer: (domain.footer == null) ? '' : domain.footer, webstate: encodeURIComponent(webstate), pluginHandler: (parent.pluginHandler == null) ? 'null' : parent.pluginHandler.prepExports(), StartGeoLocation: StartGeoLocation, EndGeoLocation: EndGeoLocation, StartGeoLocationJS: StartGeoLocationJS, EndGeoLocationJS: EndGeoLocationJS }, domain));
|
||||
});
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue