From 6daa65be02c15c9f817b0088eb40e31307b4bb7d Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Fri, 17 Mar 2017 13:36:39 -0400 Subject: [PATCH] Refine Alumni mappings Give them the correct (non-reader) profile mapping and 5 years expiry date, because alumni never really expire. Signed-off-by: Dan Scott --- tools/patron-load/ldap_osrf_sync | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/patron-load/ldap_osrf_sync b/tools/patron-load/ldap_osrf_sync index f1ec1154eb..a88e523987 100755 --- a/tools/patron-load/ldap_osrf_sync +++ b/tools/patron-load/ldap_osrf_sync @@ -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() -- 2.11.0