Skip to content

Commit

Permalink
refactor: add user to group instead of group to user
Browse files Browse the repository at this point in the history
no functional change, just improving readability
  • Loading branch information
angela-tran committed Aug 28, 2024
1 parent b7ed9f5 commit 04d3c19
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions benefits/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ def add_google_sso_userinfo(user, request):
def add_staff_user_to_group(user, request):
if user.email in settings.GOOGLE_SSO_STAFF_LIST:
staff_group = Group.objects.get(name=settings.STAFF_GROUP_NAME)
user.groups.add(staff_group)
staff_group.user_set.add(user)


def add_transit_agency_staff_user_to_group(user, request):
user_sso_domain = user.email.split("@")[1]
if user_sso_domain:
agency = models.TransitAgency.objects.filter(sso_domain=user_sso_domain).first()
if agency is not None and agency.staff_group:
user.groups.add(agency.staff_group)
agency.staff_group.user_set.add(user)

0 comments on commit 04d3c19

Please sign in to comment.