From 5862828c6876db81dcebb55dd95f760c22e3f3d1 Mon Sep 17 00:00:00 2001 From: Mike Brainerd Date: Tue, 13 Feb 2018 18:18:26 -0800 Subject: [PATCH] fixed issue where a previously authenticated user is being overridden by the default user --- .../desktop_engine_site_implementation.py | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/python/tk_desktop/desktop_engine_site_implementation.py b/python/tk_desktop/desktop_engine_site_implementation.py index 349cfe03..ff7117ba 100644 --- a/python/tk_desktop/desktop_engine_site_implementation.py +++ b/python/tk_desktop/desktop_engine_site_implementation.py @@ -416,16 +416,19 @@ def run(self, splash, version, **kwargs): if self.uses_legacy_authentication(): self._migrate_credentials() - # We need to initialize current login - # We know for sure there is a default user, since either the migration was done - # or we logged in as an actual user with the new installer. - human_user = ShotgunAuthenticator( - # We don't want to get the script user, but the human user, so tell the - # CoreDefaultsManager manager that we are not interested in the script user. Do not use - # the regular shotgun_authentication.DefaultsManager to get this user because it will - # not know about proxy information. - sgtk.util.CoreDefaultsManager(mask_script_user=True) - ).get_default_user() + human_user = sgtk.get_authenticated_user() + if not human_user: + # We need to initialize current login + # We know for sure there is a default user, since either the migration was done + # or we logged in as an actual user with the new installer. + human_user = ShotgunAuthenticator( + # We don't want to get the script user, but the human user, so tell the + # CoreDefaultsManager manager that we are not interested in the script user. Do not use + # the regular shotgun_authentication.DefaultsManager to get this user because it will + # not know about proxy information. + sgtk.authentication.CoreDefaultsManager(mask_script_user=True) + ).get_default_user() + # Cache the user so we can refresh the credentials before launching a background process self._user = human_user # Retrieve the current logged in user information. This will be used when creating