Fixed some issues with new db_user-returning credential check.

This commit is contained in:
2016-08-30 16:57:21 +02:00
parent 2c70ceb489
commit 73a62da8da
4 changed files with 10 additions and 7 deletions

View File

@@ -782,7 +782,8 @@ class PillarOperatorMixin:
async def check_credentials(self, context, required_roles) -> bool:
"""Checks credentials with Pillar, and if ok returns the user document from Pillar/MongoDB.
Returns None if the user cannot be found, or if the user is not a Cloud subscriber.
:raises UserNotLoggedInError: if the user is not logged in
:raises NotSubscribedToCloudError: if the user does not have any of the required roles
"""
# self.report({'INFO'}, 'Checking Blender Cloud credentials')
@@ -803,14 +804,16 @@ class PillarOperatorMixin:
except NotSubscribedToCloudError:
self._log_subscription_needed()
raise
except CredentialsNotSyncedError:
self.log.info('Credentials not synced after refreshing, handling as not logged in.')
raise UserNotLoggedInError('Not logged in.')
except UserNotLoggedInError:
self.log.error('User not logged in on Blender ID.')
raise
else:
self.log.info('Credentials refreshed and ok.')
return db_user
return None
def _log_subscription_needed(self):
self.log.warning(
'Please subscribe to the blender cloud at https://cloud.blender.org/join')