From 9e0445d864977a450c078ef9dbbdb3e57600332e Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Thu, 29 Aug 2019 12:19:18 -0400 Subject: [PATCH] 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 --- tools/patron-load/ldap_osrf_sync | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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' -- 2.11.0