Easy access to pillar user ID
This commit is contained in:
parent
8a5efc18db
commit
58785977e7
@ -163,6 +163,7 @@ async def check_pillar_credentials():
|
|||||||
:raises UserNotLoggedInError: when the user is not logged in on Blender ID.
|
:raises UserNotLoggedInError: when the user is not logged in on Blender ID.
|
||||||
:raises CredentialsNotSyncedError: when the user is logged in on Blender ID but
|
:raises CredentialsNotSyncedError: when the user is logged in on Blender ID but
|
||||||
doesn't have a valid subclient token for Pillar.
|
doesn't have a valid subclient token for Pillar.
|
||||||
|
:returns: the Pillar User ID of the current user.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
profile = blender_id_profile()
|
profile = blender_id_profile()
|
||||||
@ -178,7 +179,7 @@ async def check_pillar_credentials():
|
|||||||
raise CredentialsNotSyncedError()
|
raise CredentialsNotSyncedError()
|
||||||
|
|
||||||
try:
|
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):
|
except (pillarsdk.UnauthorizedAccess, pillarsdk.ResourceNotFound):
|
||||||
raise CredentialsNotSyncedError()
|
raise CredentialsNotSyncedError()
|
||||||
|
|
||||||
@ -191,6 +192,8 @@ async def check_pillar_credentials():
|
|||||||
profile.save_json()
|
profile.save_json()
|
||||||
raise NotSubscribedToCloudError()
|
raise NotSubscribedToCloudError()
|
||||||
|
|
||||||
|
return pillar_user_id
|
||||||
|
|
||||||
|
|
||||||
async def refresh_pillar_credentials():
|
async def refresh_pillar_credentials():
|
||||||
"""Refreshes the authentication token on Pillar.
|
"""Refreshes the authentication token on Pillar.
|
||||||
|
Reference in New Issue
Block a user