Easy access to pillar user ID

This commit is contained in:
Sybren A. Stüvel 2016-06-16 16:33:21 +02:00
parent 8a5efc18db
commit 58785977e7

View File

@ -163,6 +163,7 @@ async def check_pillar_credentials():
:raises UserNotLoggedInError: when the user is not logged in on Blender ID.
:raises CredentialsNotSyncedError: when the user is logged in on Blender ID but
doesn't have a valid subclient token for Pillar.
:returns: the Pillar User ID of the current user.
"""
profile = blender_id_profile()
@ -178,7 +179,7 @@ async def check_pillar_credentials():
raise CredentialsNotSyncedError()
try:
db_user = await pillar_call(pillarsdk.User.find, pillar_user_id)
db_user = await pillar_call(pillarsdk.User.me)
except (pillarsdk.UnauthorizedAccess, pillarsdk.ResourceNotFound):
raise CredentialsNotSyncedError()
@ -191,6 +192,8 @@ async def check_pillar_credentials():
profile.save_json()
raise NotSubscribedToCloudError()
return pillar_user_id
async def refresh_pillar_credentials():
"""Refreshes the authentication token on Pillar.