Support query parm of "creation end time"
authorDan Scott <dscott@laurentian.ca>
Thu, 27 Oct 2016 15:12:13 +0000 (11:12 -0400)
committerDan Scott <dscott@laurentian.ca>
Thu, 27 Oct 2016 15:46:14 +0000 (11:46 -0400)
Having both a start and end time enables staging of
updates over swathes of users by time.

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

index e88d445..8f2a418 100755 (executable)
@@ -591,6 +591,10 @@ def ldap_query(con, auth):
         ldap_filter = '(&%s(lulColleagueId=%s)(!(lulStudentLevel=APP)))' % (
             '(objectclass=lulEduPerson)', ARGS.query_id
         )
+    if (ARGS.query_end):
+        ldap_filter = '(&%s(lulPrimaryAffiliation=*)(createTimestamp>=%s)(createTimestamp<=%s))' % (
+            '(objectclass=lulEduPerson)', ARGS.query_date, ARGS.query_end
+        )
     if not ldap_filter:
         return 
     return find_ldap_users(con, ldap_filter, attributes, auth)
@@ -621,6 +625,9 @@ def parse_args():
     parser.add_argument('--query-date',
         help='Search LDAP for users created since (YYYYMMDDHHMMSSZ)'
     )
+    parser.add_argument('--query-end',
+        help='Search LDAP for users created before (YYYYMMDDHHMMSSZ)'
+    )
     parser.add_argument('--find-eg-user',
         help='Find Evergreen user by user name'
     )
index 7d5a1ef..8a1af80 100644 (file)
@@ -54,6 +54,7 @@ class LDAP_ARGS:
         self.query_cn = None
         self.query_sn = None
         self.query_date = None
+        self.query_end = None
 
     def uid(self, uid):
         self.query_id = uid