forked from shaba/openuds
Fixed logout notification
This commit is contained in:
parent
adaabf9d83
commit
73a3c89e04
@ -185,7 +185,8 @@ class UDSActorClient(threading.Thread): # pylint: disable=too-many-instance-att
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# Notify loging and mark it
|
# Notify loging and mark it
|
||||||
self._loginInfo = self.api.login(platform.operations.getCurrentUser(), platform.operations.getSessionType())
|
user, sessionType = platform.operations.getCurrentUser(), platform.operations.getSessionType()
|
||||||
|
self._loginInfo = self.api.login(user, sessionType)
|
||||||
|
|
||||||
if self._loginInfo.max_idle:
|
if self._loginInfo.max_idle:
|
||||||
platform.operations.initIdleDuration(self._loginInfo.max_idle)
|
platform.operations.initIdleDuration(self._loginInfo.max_idle)
|
||||||
@ -197,8 +198,15 @@ class UDSActorClient(threading.Thread): # pylint: disable=too-many-instance-att
|
|||||||
|
|
||||||
time.sleep(1.3) # Sleeps between loop iterations
|
time.sleep(1.3) # Sleeps between loop iterations
|
||||||
|
|
||||||
|
# If login was recognized...
|
||||||
|
if self._loginInfo.logged_in:
|
||||||
|
self.api.logout(user + self._extraLogoff, sessionType)
|
||||||
|
logger.info('Notified logout for %s (%s)', user, sessionType) # Log logout
|
||||||
|
else:
|
||||||
|
logger.info('Logout not notified for %s (%s)', user, sessionType) # Log logout
|
||||||
|
|
||||||
|
# Clean up login info
|
||||||
self._loginInfo = None
|
self._loginInfo = None
|
||||||
self.api.logout(platform.operations.getCurrentUser() + self._extraLogoff, platform.operations.getSessionType())
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error('Error on client loop: %s', e)
|
logger.error('Error on client loop: %s', e)
|
||||||
|
|
||||||
|
@ -58,6 +58,10 @@ class LoginResultInfoType(typing.NamedTuple):
|
|||||||
dead_line: typing.Optional[int]
|
dead_line: typing.Optional[int]
|
||||||
max_idle: typing.Optional[int] # Not provided by broker
|
max_idle: typing.Optional[int] # Not provided by broker
|
||||||
|
|
||||||
|
@property
|
||||||
|
def logged_in(self) -> bool:
|
||||||
|
return self.dead_line is not None or self.max_idle is not None or self.hostname != '' or self.ip != ''
|
||||||
|
|
||||||
class CertificateInfoType(typing.NamedTuple):
|
class CertificateInfoType(typing.NamedTuple):
|
||||||
private_key: str
|
private_key: str
|
||||||
server_certificate: str
|
server_certificate: str
|
||||||
|
Loading…
x
Reference in New Issue
Block a user