Skip to content

Commit

Permalink
Fixing user id dependency function
Browse files Browse the repository at this point in the history
  • Loading branch information
bergsalex committed Oct 24, 2024
1 parent bcf9877 commit 9e7564d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/geneweaver/api/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,14 @@ def _get_user_details(cursor: Cursor, user: UserInternal) -> UserInternal:
:param user: The user object.
"""
try:
user.id = db_user.by_sso_id_and_email(cursor, user.sso_id, user.email)[0][
"usr_id"
]
user.id = db_user.by_sso_id_and_email(cursor, user.sso_id, user.email).id
except IndexError as e:
if db_user.sso_id_exists(cursor, user.sso_id):
raise AuthenticationMismatch(
detail="Email and SSO ID Mismatch. Please contact and administrator."
) from e
elif db_user.email_exists(cursor, user.email):
user.id = db_user.by_email(cursor, user.email)[0]["usr_id"]
user.id = db_user.by_email(cursor, user.email).id
_ = db_user.link_user_id_with_sso_id(cursor, user.id, user.sso_id)
else:
if not user.name:
Expand Down

0 comments on commit 9e7564d

Please sign in to comment.