Skip to content

Commit

Permalink
run pre-commit again
Browse files Browse the repository at this point in the history
  • Loading branch information
aloftus23 committed Oct 1, 2024
1 parent 6993405 commit 7dc048d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions backend/src/xfd_django/xfd_api/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def is_regional_admin(current_user) -> bool:
"""Check if the user has regional admin permissions."""
return current_user and current_user.userType in ["regionalAdmin", "globalAdmin"]


def get_tag_organizations(current_user, tag_id: str) -> list[str]:
"""Returns the organizations belonging to a tag, if the user can access the tag."""
# Check if the user is a global view admin
Expand All @@ -82,7 +83,11 @@ def get_tag_organizations(current_user, tag_id: str) -> list[str]:

# Fetch the OrganizationTag and its related organizations
try:
tag = OrganizationTag.objects.prefetch_related("organizations").filter(id=tag_id).first()
tag = (
OrganizationTag.objects.prefetch_related("organizations")
.filter(id=tag_id)
.first()
)
except Exception:
return []

Expand All @@ -94,8 +99,6 @@ def get_tag_organizations(current_user, tag_id: str) -> list[str]:
return []




# TODO: Below is a template of what these could be nut isn't tested
# RECREATE ALL THE FUNCTIONS IN AUTH.TS

Expand Down

0 comments on commit 7dc048d

Please sign in to comment.