validate that the user exists on ftrack when ftrack credentials are checked

This commit is contained in:
Jakub Trllo 2022-05-23 19:04:34 +02:00
parent 7df83e1f6a
commit d02af55c05

View file

@ -92,14 +92,18 @@ def check_credentials(username, api_key, ftrack_server=None):
if not ftrack_server or not username or not api_key:
return False
user_exists = False
try:
session = ftrack_api.Session(
server_url=ftrack_server,
api_key=api_key,
api_user=username
)
# Validated that the username actually exists
user = session.query("User where username is \"{}\"".format(username))
user_exists = user is not None
session.close()
except Exception:
return False
return True
pass
return user_exists