From 58785977e714059b426abc1f05f311ecb26afa9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 16 Jun 2016 16:33:21 +0200 Subject: [PATCH] Easy access to pillar user ID --- blender_cloud/pillar.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/blender_cloud/pillar.py b/blender_cloud/pillar.py index f722889..007eac6 100644 --- a/blender_cloud/pillar.py +++ b/blender_cloud/pillar.py @@ -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.