From: Dan Scott Date: Thu, 27 Oct 2016 15:15:50 +0000 (-0400) Subject: Make loginExpirationTime attribute great again X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=5b57469e398f3568899a7e914f1e202673f0ec14;p=contrib%2FConifer.git Make loginExpirationTime attribute great again If the LDAP record has this attribute, it should trump everything. Signed-off-by: Dan Scott --- diff --git a/tools/patron-load/ldap_osrf_sync b/tools/patron-load/ldap_osrf_sync index 8f2a41897e..188899d41e 100755 --- a/tools/patron-load/ldap_osrf_sync +++ b/tools/patron-load/ldap_osrf_sync @@ -132,9 +132,17 @@ class User: """ expiry_date = '%d-09-30' % (datetime.date.today().year + 1) + exp_att = self._simple_map('loginExpirationTime') + + # Go with the LDAP-set expiry date + if 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 - if self.profile == 11 or self.profile == 14: + elif self.profile == 11 or self.profile == 14: expiry_date = '%d-09-30' % (datetime.date.today().year + 8) + # Expire the visiting students Sept. 30th + elif self.affiliation == 'visitor': + expiry_date = '%d-09-30' % (datetime.date.today().year + 1) return expiry_date @@ -572,7 +580,7 @@ def ldap_query(con, auth): 'lulLibraryBarcode', 'createTimestamp', 'lulAffiliation', 'lulStudentLevel', 'lulPrimaryAffiliation', 'cn', 'mail', 'givenName', 'sn', 'lulColleagueId', 'preferredLanguage', - 'lulModifyTimestamp' + 'lulModifyTimestamp', 'loginExpirationTime' ] if (ARGS.query_date):