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,
'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: