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'