Make IDLE_TIMEOUT avoidable with account-lock.

Resolves #701. Check the Account-lock 'no_idle_disconnect before kicking an idle
session. This also means superusers will never be kicked. Move the
idle task to the Server to avoid lock imports in Portal. Make the
'lock' command also able to target Accounts. Also some other fixes.
This commit is contained in:
Griatch 2017-08-20 23:11:33 +02:00
parent cdac9678b9
commit 8a2e362b7c
11 changed files with 63 additions and 52 deletions

View file

@ -9,7 +9,6 @@ are stored on the Portal side)
from builtins import object
import weakref
import importlib
import time
from django.utils import timezone
from django.conf import settings
@ -232,7 +231,7 @@ class ServerSession(Session):
# add the session-level cmdset
self.cmdset = CmdSetHandler(self, True)
def at_disconnect(self):
def at_disconnect(self, reason=None):
"""
Hook called by sessionhandler when disconnecting this session.
@ -245,7 +244,7 @@ class ServerSession(Session):
uaccount.last_login = timezone.now()
uaccount.save()
# calling account hook
account.at_disconnect()
account.at_disconnect(reason)
self.logged_in = False
if not self.sessionhandler.sessions_from_account(account):
# no more sessions connected to this account