diff --git a/python/tank/authentication/login_dialog.py b/python/tank/authentication/login_dialog.py index fd2452962..1dfac7e59 100644 --- a/python/tank/authentication/login_dialog.py +++ b/python/tank/authentication/login_dialog.py @@ -69,19 +69,6 @@ # request thread. THREAD_WAIT_TIMEOUT_MS = 5000 - -def _is_running_in_desktop(): - """ - Indicate if we are in the context of the PTR desktop app. - - When the PTR desktop app is used, we want to disregard the value returned - by the call to `get_shotgun_authenticator_support_web_login()` when the - target site is using Autodesk Identity. - """ - executable_name = os.path.splitext(os.path.basename(sys.executable))[0].lower() - return executable_name in ["shotgun", "shotgrid"] - - class QuerySiteAndUpdateUITask(QtCore.QThread): """ This class uses a different thread to query the site's information and find @@ -493,8 +480,7 @@ def _toggle_web(self, method_selected=None): if os.environ.get("SGTK_FORCE_STANDARD_LOGIN_DIALOG"): logger.info("Using the standard login dialog with the Flow Production Tracking") else: - if _is_running_in_desktop(): - can_use_web = can_use_web or self.site_info.autodesk_identity_enabled + can_use_web = can_use_web or self.site_info.autodesk_identity_enabled # If we have full support for Web-based login, or if we enable it in our # environment, use the Unified Login Flow for all authentication modes. diff --git a/tests/authentication_tests/test_interactive_authentication.py b/tests/authentication_tests/test_interactive_authentication.py index 3fce6dcca..c85aab952 100644 --- a/tests/authentication_tests/test_interactive_authentication.py +++ b/tests/authentication_tests/test_interactive_authentication.py @@ -518,10 +518,6 @@ def test_ui_auth_with_whitespace(self): "tank.authentication.site_info._get_site_infos", return_value={}, ) - @mock.patch( - "tank.authentication.login_dialog._is_running_in_desktop", - return_value=True, - ) def test_ui_error_management(self, *unused_mocks): # Empty of invalid site with self._login_dialog() as ld: @@ -635,10 +631,6 @@ def test_login_dialog_exit_confirmation(self): self.assertEqual(ld.isVisible(), False) @suppress_generated_code_qt_warnings - @mock.patch( - "tank.authentication.login_dialog._is_running_in_desktop", - return_value=True, - ) @mock.patch( "tank.authentication.web_login_support.get_shotgun_authenticator_support_web_login", return_value=True, @@ -778,10 +770,6 @@ def test_ui_auth_2fa(self, *mocks): ) @suppress_generated_code_qt_warnings - @mock.patch( - "tank.authentication.login_dialog._is_running_in_desktop", - return_value=True, - ) @mock.patch( "tank.authentication.login_dialog.get_shotgun_authenticator_support_web_login", return_value=True, @@ -834,9 +822,6 @@ def test_web_login_not_supported(self): with mock.patch( "tank.authentication.login_dialog.ASL_AuthTask.start" - ), mock.patch( - "tank.authentication.login_dialog._is_running_in_desktop", - return_value=True, ), mock.patch( "tank.authentication.login_dialog.get_shotgun_authenticator_support_web_login", return_value=False, @@ -858,9 +843,6 @@ def test_web_login_not_supported(self): def test_login_dialog_method_selected_default(self): with mock.patch( "tank.authentication.login_dialog.ASL_AuthTask.start" - ), mock.patch( - "tank.authentication.login_dialog._is_running_in_desktop", - return_value=True, ), mock.patch( "tank.authentication.login_dialog.get_shotgun_authenticator_support_web_login", return_value=True, @@ -932,12 +914,16 @@ def test_login_dialog_method_selected_default(self): { "SGTK_DEFAULT_AUTH_METHOD": "qt_web_login", }, - ), mock.patch( - "tank.authentication.login_dialog._is_running_in_desktop", - return_value=False, ), mock.patch( "tank.authentication.login_dialog.get_shotgun_authenticator_support_web_login", return_value=False, + ), mock.patch( + "tank.authentication.site_info._get_site_infos", + return_value={ + "user_authentication_method": "default", + "unified_login_flow_enabled": True, + "authentication_app_session_launcher_enabled": True, + }, ), self._login_dialog( hostname="https://host.shotgunstudio.com", ) as ld: @@ -965,16 +951,13 @@ def test_login_dialog_method_selected_default(self): def test_login_dialog_method_selected_session_cache(self): with mock.patch( "tank.authentication.login_dialog.ASL_AuthTask.start" - ), mock.patch( - "tank.authentication.login_dialog._is_running_in_desktop", - return_value=True, ), mock.patch( "tank.authentication.login_dialog.get_shotgun_authenticator_support_web_login", return_value=True, ), mock.patch( "tank.authentication.site_info._get_site_infos", return_value={ - "user_authentication_method": "oxygen", + "user_authentication_method": "default", "unified_login_flow_enabled": True, "authentication_app_session_launcher_enabled": True, }, @@ -995,9 +978,6 @@ def test_login_dialog_method_selected_session_cache(self): # qt_web_login but method is not available with mock.patch( - "tank.authentication.login_dialog._is_running_in_desktop", - return_value=False, - ), mock.patch( "tank.authentication.login_dialog.get_shotgun_authenticator_support_web_login", return_value=False, ), mock.patch( @@ -1015,10 +995,6 @@ def test_login_dialog_method_selected_session_cache(self): @suppress_generated_code_qt_warnings @mock.patch("tank.authentication.login_dialog.ASL_AuthTask.start") - @mock.patch( - "tank.authentication.login_dialog._is_running_in_desktop", - return_value=True, - ) @mock.patch( "tank.authentication.login_dialog.get_shotgun_authenticator_support_web_login", return_value=True,