mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-11 05:17:55 +03:00
fixed login/logout
This commit is contained in:
parent
08f14bff57
commit
d9d3bc452c
@ -42,7 +42,7 @@ class LocalProvider(handler.Handler):
|
|||||||
return result._asdict()
|
return result._asdict()
|
||||||
|
|
||||||
def post_logout(self) -> typing.Any:
|
def post_logout(self) -> typing.Any:
|
||||||
self._service.logout(self._params['username'])
|
self._service.logout(self._params['username'], self._params['session_type'])
|
||||||
return 'ok'
|
return 'ok'
|
||||||
|
|
||||||
def post_ping(self) -> typing.Any:
|
def post_ping(self) -> typing.Any:
|
||||||
|
@ -465,7 +465,7 @@ class CommonService: # pylint: disable=too-many-instance-attributes
|
|||||||
|
|
||||||
# Now check if every registered client is already there (if logged in OFC)
|
# Now check if every registered client is already there (if logged in OFC)
|
||||||
if self._loggedIn and not self._clientsPool.ping():
|
if self._loggedIn and not self._clientsPool.ping():
|
||||||
self.logout('client_unavailable')
|
self.logout('client_unavailable', '')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error('Exception on main service loop: %s', e)
|
logger.error('Exception on main service loop: %s', e)
|
||||||
|
|
||||||
@ -488,8 +488,6 @@ class CommonService: # pylint: disable=too-many-instance-attributes
|
|||||||
result = types.LoginResultInfoType(
|
result = types.LoginResultInfoType(
|
||||||
ip='', hostname='', dead_line=None, max_idle=None
|
ip='', hostname='', dead_line=None, max_idle=None
|
||||||
)
|
)
|
||||||
self._loggedIn = True
|
|
||||||
|
|
||||||
master_token = None
|
master_token = None
|
||||||
secret = None
|
secret = None
|
||||||
# If unmanaged, do initialization now, because we don't know before this
|
# If unmanaged, do initialization now, because we don't know before this
|
||||||
@ -515,16 +513,16 @@ class CommonService: # pylint: disable=too-many-instance-attributes
|
|||||||
secret,
|
secret,
|
||||||
)
|
)
|
||||||
|
|
||||||
script = platform.store.invokeScriptOnLogin()
|
if result.logged_in:
|
||||||
if script:
|
self._loggedIn = True
|
||||||
script += f'{username} {sessionType or "unknown"} {self._cfg.actorType}'
|
script = platform.store.invokeScriptOnLogin()
|
||||||
self.execute(script, 'Logon')
|
if script:
|
||||||
|
script += f'{username} {sessionType or "unknown"} {self._cfg.actorType}'
|
||||||
|
self.execute(script, 'Logon')
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def logout(self, username: str, sessionType: typing.Optional[str] = None) -> None:
|
def logout(self, username: str, sessionType: typing.Optional[str]) -> None:
|
||||||
self._loggedIn = False
|
|
||||||
|
|
||||||
master_token = self._cfg.master_token
|
master_token = self._cfg.master_token
|
||||||
|
|
||||||
# Own token will not be set if UDS did not assigned the initialized VM to an user
|
# Own token will not be set if UDS did not assigned the initialized VM to an user
|
||||||
@ -546,6 +544,7 @@ class CommonService: # pylint: disable=too-many-instance-attributes
|
|||||||
logger.info('Logout from %s ignored as required by uds broker', username)
|
logger.info('Logout from %s ignored as required by uds broker', username)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
self._loggedIn = False
|
||||||
self.onLogout(username)
|
self.onLogout(username)
|
||||||
|
|
||||||
if not self.isManaged():
|
if not self.isManaged():
|
||||||
|
Loading…
Reference in New Issue
Block a user