diff options
| author | Jonathan Weth <git@jonathanweth.de> | 2021-06-23 12:23:41 +0200 |
|---|---|---|
| committer | Jonathan Weth <git@jonathanweth.de> | 2021-06-23 12:23:41 +0200 |
| commit | 74e02d1953c1ee03a4e7dfc73e80318a24ba56a7 (patch) | |
| tree | c204dcc7794b05641b1dd6910b649a754169184d /service.py | |
| parent | 0a6543a5bea6838d6e4d80eaa83046cc6576b086 (diff) | |
| download | RWA.Support.SessionService-74e02d1953c1ee03a4e7dfc73e80318a24ba56a7.tar.gz RWA.Support.SessionService-74e02d1953c1ee03a4e7dfc73e80318a24ba56a7.tar.bz2 RWA.Support.SessionService-74e02d1953c1ee03a4e7dfc73e80318a24ba56a7.zip | |
Generate PIN in this service and provide authentication mechanisms
Diffstat (limited to 'service.py')
| -rwxr-xr-x | service.py | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -33,7 +33,7 @@ import signal import tempfile import time from threading import Thread -from typing import Union +from typing import Union, Any import dbus import dbus.mainloop.glib @@ -238,17 +238,17 @@ class RWASupportSessionService(dbus.service.Object): if self.one_time: self._stop_all() - def _trigger(self, token: str) -> bool: + def _trigger(self, session_id: int, data: dict, method: str = "trigger") -> Union[dict, bool]: """Trigger a specific session via trigger token.""" - logging.info(f"Triggered with token {token}") + logging.info(f"Triggered with session ID {session_id} and {data}") for session in self.sessions.values(): - if token == session.trigger_token: - logging.info(f"Session #{session.pid} matches the token.") - session.trigger() - return True + if session.session_id == session_id: + r = session.trigger(data, method) + logging.info(f"Session #{session.pid} matches the ID: {r}") + return r - logging.warning(" No matching session found for this token.") + logging.warning(" No matching session found for this ID.") return False def _stop_all(self): |
