mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-02-12 11:01:52 +00:00
Add support for logoutOnIdleSessionTimeout (#6773)
This commit is contained in:
parent
0b376fe5a0
commit
9d4f51e970
7 changed files with 32 additions and 5 deletions
|
@ -2180,6 +2180,11 @@
|
|||
"default": null,
|
||||
"description": "When set, idle users will be disconnected after a set amounts of minutes."
|
||||
},
|
||||
"logoutOnIdleSessionTimeout": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "Determines whether MeshCentral should logout after the session idle timeout elapsed or should just disconnect remote desktop, terminal and files."
|
||||
},
|
||||
"userConsentFlags": {
|
||||
"type": "object",
|
||||
"description": "Use this section to require user consent for this domain.",
|
||||
|
|
|
@ -600,7 +600,13 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||
}
|
||||
}
|
||||
if (typeof domain.userconsentflags == 'number') { serverinfo.consent = domain.userconsentflags; }
|
||||
if ((typeof domain.usersessionidletimeout == 'number') && (domain.usersessionidletimeout > 0)) { serverinfo.timeout = (domain.usersessionidletimeout * 60 * 1000); }
|
||||
if ((typeof domain.usersessionidletimeout == 'number') && (domain.usersessionidletimeout > 0)) {serverinfo.timeout = (domain.usersessionidletimeout * 60 * 1000); }
|
||||
if (typeof domain.logoutOnIdleSessionTimeout == 'boolean') {
|
||||
serverinfo.logoutOnIdleSessionTimeout = domain.logoutOnIdleSessionTimeout;
|
||||
} else {
|
||||
// Default
|
||||
serverinfo.logoutOnIdleSessionTimeout = true;
|
||||
}
|
||||
if (user.siteadmin === SITERIGHT_ADMIN) {
|
||||
if (parent.parent.config.settings.managealldevicegroups.indexOf(user._id) >= 0) { serverinfo.manageAllDeviceGroups = true; }
|
||||
if (obj.crossDomain === true) { serverinfo.crossDomain = []; for (var i in parent.parent.config.domains) { serverinfo.crossDomain.push(i); } }
|
||||
|
|
|
@ -386,6 +386,8 @@
|
|||
"_agentBlockedIP": "127.0.0.1,::1",
|
||||
"___userSessionIdleTimeout__": "Number of user idle minutes before auto-disconnect",
|
||||
"_userSessionIdleTimeout": 30,
|
||||
"___logoutOnIdleSessionTimeout": "Determines whether MeshCentral should logout after the session idle timeout elapsed or should just disconnect remote desktop, terminal and files.",
|
||||
"_logoutOnIdleSessionTimeout": false,
|
||||
"userConsentFlags": {
|
||||
"desktopnotify": true,
|
||||
"terminalnotify": true,
|
||||
|
|
|
@ -1522,7 +1522,12 @@
|
|||
}
|
||||
|
||||
function setSessionActivity() { sessionActivity = Date.now(); }
|
||||
function checkIdleSessionTimeout() { var delta = (Date.now() - sessionActivity); if (delta > serverinfo.timeout) { window.location.href = 'logout'; } }
|
||||
function checkIdleSessionTimeout() {
|
||||
var delta = (Date.now() - sessionActivity);
|
||||
if (delta > serverinfo.timeout && serverinfo.logoutOnIdleSessionTimeout) {
|
||||
window.location.href = 'logout';
|
||||
}
|
||||
}
|
||||
|
||||
function onMessage(server, message) {
|
||||
switch (message.action) {
|
||||
|
|
|
@ -2447,7 +2447,9 @@
|
|||
files.Stop();
|
||||
files = null;
|
||||
}
|
||||
window.location.href = 'logout';
|
||||
if (serverinfo.logoutOnIdleSessionTimeout) {
|
||||
window.location.href = 'logout';
|
||||
}
|
||||
} else {
|
||||
var ds = Math.round((serverinfo.timeout - delta) / 1000);
|
||||
if (ds <= 60) {
|
||||
|
|
|
@ -2897,7 +2897,9 @@
|
|||
files.Stop();
|
||||
files = null;
|
||||
}
|
||||
window.location.href = 'logout';
|
||||
if (serverinfo.logoutOnIdleSessionTimeout) {
|
||||
window.location.href = 'logout';
|
||||
}
|
||||
} else {
|
||||
var ds = Math.round((serverinfo.timeout - delta) / 1000);
|
||||
if (ds <= 60) {
|
||||
|
|
|
@ -820,7 +820,12 @@
|
|||
}
|
||||
|
||||
function setSessionActivity() { sessionActivity = Date.now(); }
|
||||
function checkIdleSessionTimeout() { var delta = (Date.now() - sessionActivity); if (delta > serverinfo.timeout) { window.location.href = 'logout'; } }
|
||||
function checkIdleSessionTimeout() {
|
||||
var delta = (Date.now() - sessionActivity);
|
||||
if (delta > serverinfo.timeout && serverinfo.logoutOnIdleSessionTimeout) {
|
||||
window.location.href = 'logout';
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Menu System
|
||||
|
|
Loading…
Reference in a new issue