Skip to content

Commit b1e6e42

Browse files
committed
Identify STARS Liaison in MemberSuite differently
1 parent 18fd520 commit b1e6e42

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

membersuite_api_client/organizations/services.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,26 @@ def get_individuals_for_primary_organization(self,
139139

140140
return individuals
141141

142+
# get_stars_liaison_for_organization doesn't belong here. It should
143+
# live in some AASHE-specific place, not in OrganizationService.
142144
def get_stars_liaison_for_organization(self, organization):
145+
143146
candidates = self.get_individuals_for_primary_organization(
144147
organization=organization)
148+
149+
# Check for a STARS Primary Contact first:
145150
for candidate in candidates:
146151
if "StarsPrimaryContact__rt" in candidate.fields:
147152
return candidate
153+
154+
# No STARS Primary Contact? Try the account's primary contact:
155+
for candidate in candidates:
156+
if "Primary_Contact__rt" in candidate.fields:
157+
return candidate
158+
159+
# No primary contact? Try billing contact:
160+
for candidate in candidates:
161+
if "Billing_Contact__rt" in candidate.fields:
162+
return candidate
163+
148164
return None

membersuite_api_client/security/services.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ def logout(client):
8282
raise LogoutError(result=result)
8383

8484

85+
# get_user_for_membersuite_entity introduces a dependency on
86+
# Django (django.contrib.auth.models, to be precise). That's
87+
# quite a drag. Goes someplace else. Need to drop dependency
88+
# on Django.
8589
def get_user_for_membersuite_entity(membersuite_entity):
8690
"""Returns a User for `membersuite_entity`.
8791

0 commit comments

Comments
 (0)