Skip to content

Commit

Permalink
Fix impersonation suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
benjackwhite committed Dec 18, 2024
1 parent 98bd101 commit 1b2bf11
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions posthog/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,10 @@ def can_switch_to_team(self, new_team: Team, request: HttpRequest):

# :KLUDGE: This is more inefficient than needed, doing several expensive lookups
# However this should be a rare operation!
if not user_access_control.check_access_level_for_object(new_team, "member"):
# Do something to indicate that they don't have access to the team...
return False

# :KLUDGE: This is more inefficient than needed, doing several expensive lookups
# However this should be a rare operation!
if user_permissions.team(new_team).effective_membership_level is None:
if (
not user_access_control.check_access_level_for_object(new_team, "member")
and user_permissions.team(new_team).effective_membership_level is None
):
if user.is_staff:
# Staff users get a popup with suggested users to log in as, facilating support
request.suggested_users_with_access = UserBasicSerializer( # type: ignore
Expand Down

0 comments on commit 1b2bf11

Please sign in to comment.