From 0bc485e2c4ccdc5e117bbb9f12d85e926ba7deac Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Wed, 13 Nov 2024 19:41:20 +0100 Subject: src: add user session detection implementation Detect user login and logout for Linux and Windows. Report an active interactive session through the /refresh response so a new ogserver instance can update the session status. Poll the session change in 5 second intervals in a thread. Use the same event socket previously used by the old session detection mechanism to notify a session change. Use the method check_interactive_session_change in each ogOperations.py to report the session status. Return values: None: no session changes are found True: login False: logout Windows check_interactive_session_change uses the WMI API to obtain session information. Obtain the list of sessions associated to interactive sessions and then filter the sessions with a valid user. Linux Check if any user has the DISPLAY or WAYLAND_DISPLAY environment variable defined as that means there is an interactive session in execution. --- src/virtual/ogOperations.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/virtual/ogOperations.py') diff --git a/src/virtual/ogOperations.py b/src/virtual/ogOperations.py index c51f59d..86ae0ed 100644 --- a/src/virtual/ogOperations.py +++ b/src/virtual/ogOperations.py @@ -629,3 +629,6 @@ class OgVirtualOperations: for k, v in device_names.items(): f.write(f'{k}={v}\n') f.truncate() + + def check_interactive_session_change(self): + return None -- cgit v1.2.3-18-g5258