Skip to content

Commit

Permalink
Make sure org id is in returned in /users/me
Browse files Browse the repository at this point in the history
  • Loading branch information
aloftus23 committed Dec 13, 2024
1 parent b1cb234 commit c6b38ac
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 24 additions & 1 deletion backend/src/xfd_django/xfd_api/api_methods/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,30 @@ def get_me(current_user):
"id": role.id,
"role": role.role,
"approved": role.approved,
"organization": model_to_dict(role.organization)
"organization": {
**model_to_dict(
role.organization,
fields=[
"acronym",
"name",
"rootDomains",
"ipBlocks",
"isPassive",
"pendingDomains",
"country",
"state",
"regionId",
"stateFips",
"stateName",
"county",
"countyFips",
"type",
"parent",
"createdBy",
],
),
"id": str(role.organization.id), # Explicitly add the ID
}
if role.organization
else None,
}
Expand Down
2 changes: 2 additions & 0 deletions backend/src/xfd_django/xfd_api/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,8 @@ def get_stats_org_ids(current_user, filters):
organizations_filter = (
filters.filters.organizations if filters and filters.filters else []
)
if organizations_filter == [""]:
organizations_filter = []
tags_filter = filters.filters.tags if filters and filters.filters else []

# Final list of organization IDs
Expand Down

0 comments on commit c6b38ac

Please sign in to comment.