From: Dan Scott Date: Thu, 29 Aug 2019 16:19:18 +0000 (-0400) Subject: Tweak graduate vs. undergraduate profile determination X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=9e0445d864977a450c078ef9dbbdb3e57600332e;p=contrib%2FConifer.git Tweak graduate vs. undergraduate profile determination If lulPrimaryAffiliation = 'Student', we also need to check lulStudentLevel to determine if they are graduate or undergraduate students. Signed-off-by: Dan Scott --- diff --git a/tools/patron-load/ldap_osrf_sync b/tools/patron-load/ldap_osrf_sync index b5104ca161..ebd1725881 100755 --- a/tools/patron-load/ldap_osrf_sync +++ b/tools/patron-load/ldap_osrf_sync @@ -199,13 +199,18 @@ class User: if att in self.ldap_atts: affiliation = self._simple_map(att).lower() if affiliation in profile_map: + if affiliation == 'student': + if 'lulStudentLevel' in self.ldap_atts and self._simple_map('lulStudentLevel').lower() == 'gr': + self.affiliation = 'gr' + else: + self.affiliation = 'ug' + else: self.affiliation = affiliation - return profile_map[affiliation] - if 'alumni' in self.cname.lower(): - # we have a winner! - affiliation = 'alumni' - elif 'empl' in self.cname.lower(): + if hasattr(self, 'affiliation'): + return profile_map[affiliation] + + if 'empl' in self.cname.lower(): affiliation = 'staff' else: affiliation = r'\N'