Different timing for session timeout based on user role.

0
Hi Team, Is there a possibility to set different timing for session timeout to logout a user automatically based on user role and also to configure the timing dynamically? I checked Idle timer widget but can’t achieve it for different user roles. Please let me know how can i achieve it. Thanks in advance!
asked
1 answers
0

Something like this

if(
    this.contextObj!=null
){
	var ms=this.contextObj.get('sessionTimeout');
	if(ms!=null&&ms>0){
		(function(){
			var t;
			window.onload = resetTimer;
			window.onmousemove = resetTimer;
			window.onmousedown = resetTimer;
			window.ontouchstart = resetTimer;
			window.onclick = resetTimer;
			window.onkeypress = resetTimer;   
			window.addEventListener('scroll',resetTimer,true);
			function logout(){
				console.log('Logging Out');
				mx.logout();
			}
			function resetTimer() {
				console.log('Timer Reset');
				clearTimeout(t);
				t = setTimeout(logout,ms);
			}
		})();
	}
}

The contextObj is some table associated with the role with a field for the timeout in milliseconds

answered