From: Dan Scott Date: Thu, 27 Oct 2016 15:19:27 +0000 (-0400) Subject: Add visitor profile parsing X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=8476b3e83e5e13e92b495503fd345258e0d90d74;p=contrib%2FConifer.git Add visitor profile parsing We have a strange category of students who come here for the summer but are not officially LU students, so treat them as visitors. More work may need to be done to distinguish them from guests. Signed-off-by: Dan Scott --- diff --git a/tools/patron-load/ldap_osrf_sync b/tools/patron-load/ldap_osrf_sync index 7deb46c448..cf104dadcb 100755 --- a/tools/patron-load/ldap_osrf_sync +++ b/tools/patron-load/ldap_osrf_sync @@ -178,15 +178,6 @@ class User: Map LDAP record to Evergreen profile """ - if 'alumni' in self.cname.lower(): - affiliation = 'alumni' - elif 'lulStudentLevel' in self.ldap_atts: - affiliation = self._simple_map('lulStudentLevel').lower() - elif 'lulPrimaryAffiliation' in self.ldap_atts: - affiliation = self._simple_map('lulPrimaryAffiliation').lower() - else: - affiliation = r'\N' - profile_map = { 'ug': 113, 'student': 113, @@ -200,9 +191,28 @@ class User: 'thornloe': 115, 'proxy': None, 'retired': None, - 'affiliate': 115 + 'affiliate': 115, + 'visitor': 113 } + for att in ('lulStudentLevel', 'lulPrimaryAffiliation', 'lulAffiliation'): + if att in self.ldap_atts: + affiliation = self._simple_map(att).lower() + if affiliation in profile_map: + 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(): + affiliation = 'staff' + else: + affiliation = r'\N' + + # Let's remember the affiliation + self.affiliation = affiliation + if affiliation in profile_map: return profile_map[affiliation] else: