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

Fixed comms for non suporting coms user services

This commit is contained in:
Adolfo Gómez García 2020-06-12 13:53:51 +02:00
parent d9a948df38
commit f01d4302cf
2 changed files with 13 additions and 3 deletions

View File

@ -184,6 +184,7 @@ class Services(DetailHandler): # pylint: disable=too-many-public-methods
raise self.invalidItemException()
except IntegrityError: # Duplicate key probably
if service and service.token:
service.delete()
raise RequestError(_('Service token seems to be in use by other service. Please, select a new one.'))
raise RequestError(_('Element already exists (duplicate key error)'))
except services.Service.ValidationException as e:

View File

@ -126,16 +126,25 @@ def sendScript(userService: 'UserService', script: str, forUser: bool = False) -
"""
If allowed, send script to user service
"""
_requestActor(userService, 'script', data={'script': script, 'user': forUser}, minVersion='3.0.0')
try:
_requestActor(userService, 'script', data={'script': script, 'user': forUser}, minVersion='3.0.0')
except NoActorComms:
pass
def requestLogoff(userService: 'UserService') -> None:
"""
Ask client to logoff user
"""
_requestActor(userService, 'logout', data={})
try:
_requestActor(userService, 'logout', data={})
except NoActorComms:
pass
def sendMessage(userService: 'UserService', message: str) -> None:
"""
Sends an screen message to client
"""
_requestActor(userService, 'message', data={'message':message})
try:
_requestActor(userService, 'message', data={'message':message})
except NoActorComms:
pass