From 8476b3e83e5e13e92b495503fd345258e0d90d74 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Thu, 27 Oct 2016 11:19:27 -0400 Subject: [PATCH] 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 --- tools/patron-load/ldap_osrf_sync | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) 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: -- 2.11.0