def process_login(userService: UserService, username: str) -> typing.Optional[osmanagers.OSManager]: osManager: typing.Optional[ osmanagers.OSManager] = userService.getOsManagerInstance() if not userService.in_use: # If already logged in, do not add a second login (windows does this i.e.) osmanagers.OSManager.loggedIn(userService, username) return osManager
def process_logout(userService: UserService, username: str) -> None: """ This method is static so can be invoked from elsewhere """ osManager: typing.Optional[ osmanagers.OSManager] = userService.getOsManagerInstance() if userService.in_use: # If already logged out, do not add a second logout (windows does this i.e.) osmanagers.OSManager.loggedOut(userService, username) if osManager: if osManager.isRemovableOnLogout(userService): logger.debug('Removable on logout: %s', osManager) userService.remove() else: userService.remove()