Refine Alumni mappings
authorDan Scott <dscott@laurentian.ca>
Fri, 17 Mar 2017 17:36:39 +0000 (13:36 -0400)
committerDan Scott <dscott@laurentian.ca>
Fri, 17 Mar 2017 17:36:39 +0000 (13:36 -0400)
Give them the correct (non-reader) profile mapping and 5 years expiry
date, because alumni never really expire.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
tools/patron-load/ldap_osrf_sync

index f1ec115..a88e523 100755 (executable)
@@ -134,8 +134,11 @@ class User:
         expiry_date = '%d-09-30' % (datetime.date.today().year + 1)
         exp_att = self._simple_map('loginExpirationTime')
 
+        # Alumni get extended expiry dates
+        if self.profile == 127:
+            expiry_date = '%d-09-30' % (datetime.date.today().year + 5)
         # Go with the LDAP-set expiry date
-        if exp_att:
+        elif exp_att:
             expiry_date = "%s-%s-%s" % (exp_att[:4], exp_att[4:6], exp_att[6:8])
         # Faculty and staff get a long time
         elif self.profile == 111 or self.profile == 115:
@@ -182,9 +185,9 @@ class User:
             'ug': 113,
             'student': 113,
             'gr': 112,
-            'al': 114,
-            'alumni': 114,
+            'al': 127,
             'guest': 114,
+            'alumni': 127,
             'faculty': 111,
             'staff': 115,
             'thorneloe': 115,
@@ -195,6 +198,11 @@ class User:
             'visitor': 113
         }
 
+        if 'alumni' in self.cname.lower():
+            # we have a winner!
+            affiliation = 'alumni'
+            return profile_map[affiliation]
+
         for att in ('lulPrimaryAffiliation', 'lulStudentLevel', 'lulAffiliation'):
             if att in self.ldap_atts:
                 affiliation = self._simple_map(att).lower()