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

@ -500,11 +500,12 @@ class ServerSessionHandler(SessionHandler):
if hasattr(session, "account") and session.account:
# only log accounts logging off
nsess = len(self.sessions_from_account(session.account)) - 1
string = "Logged out: {account} {address} ({nsessions} sessions(s) remaining)"
string = string.format(account=session.account, address=session.address, nsessions=nsess)
sreason = " ({})".format(reason) if reason else ""
string = "Logged out: {account} {address} ({nsessions} sessions(s) remaining){reason}"
string = string.format(reason=sreason, account=session.account, address=session.address, nsessions=nsess)
session.log(string)
session.at_disconnect()
session.at_disconnect(reason)
sessid = session.sessid
if sessid in self and not hasattr(self, "_disconnect_all"):
del self[sessid]