1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-23 17:34:17 +03:00

Updated rest to check own_token

This commit is contained in:
Adolfo Gómez 2020-02-11 15:01:27 +01:00
parent 903ccf2e0a
commit d11ffbd401
2 changed files with 9 additions and 1 deletions

View File

@ -247,6 +247,8 @@ class UDSServerApi(UDSApi):
)
def login(self, own_token: str, username: str) -> types.LoginResultInfoType:
if not own_token:
return
payload = {
'token': own_token,
'username': username
@ -260,6 +262,8 @@ class UDSServerApi(UDSApi):
)
def logout(self, own_token: str, username: str) -> None:
if not own_token:
return
payload = {
'token': own_token,
'username': username
@ -268,6 +272,8 @@ class UDSServerApi(UDSApi):
def log(self, own_token: str, level: int, message: str) -> None:
if not own_token:
return
payLoad = {
'token': own_token,
'level': level,

View File

@ -381,15 +381,17 @@ class CommonService: # pylint: disable=too-many-instance-attributes
if self._cfg.own_token:
result = self._api.login(self._cfg.own_token, username)
return result
def logout(self, username: str) -> None:
self._loggedIn = False
if self._cfg.own_token:
self._api.logout(self._cfg.own_token, username)
self.onLogout(username)
self._cfg = self._cfg._replace(own_token=None)
self._cfg = self._cfg._replace(own_token=None) # Ensures assigned token is cleared
# ****************************************
# Methods that CAN BE overriden by actors