Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: more logging around user lookup logic #508

Merged
merged 3 commits into from
Dec 18, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions eligibility_server/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,24 @@ def _check_user(self, sub, name, types):
if len(types) < 1:
logger.debug("List of types to check was empty.")
return []
else:
logger.debug(f"Types to check: {types}")

if self.hash:
sub = self.hash.hash_input(sub)
name = self.hash.hash_input(name)

logger.debug(f"Hashed sub, name: {sub},{name}")

existing_user = User.query.filter_by(sub=sub, name=name).first()
if existing_user:
existing_user_types = [type.name for type in existing_user.types]
logger.debug(f"Existing types on user: {existing_user_types}")
else:
existing_user_types = []
thekaveman marked this conversation as resolved.
Show resolved Hide resolved

matching_types = set(existing_user_types) & set(types)
logger.debug(f"Matching types: {matching_types}")

if existing_user is None:
logger.debug("Database does not contain requested user.")
Expand Down
Loading