UPDATE actor.usr
SET home_ou = su.home_ou,
- usrname = LOWER(su.usrname),
+ usrname = LOWER(su.email),
profile = su.profile,
- email = LOWER(su.email)
+ email = LOWER(su.email),
+ expire_date = '2012-09-30'::date
FROM scratchpad.usr_staging su
WHERE su.ident_value= actor.usr.ident_value
AND su.profile IS NOT NULL
WHERE profile IS NULL;
INSERT INTO actor.usr (usrname, passwd, email, first_given_name, family_name, home_ou, ident_type, ident_value, profile, expire_date)
- SELECT LOWER(usrname), MD5(RANDOM()::TEXT), LOWER(email), first_given_name, family_name, home_ou, 2, ident_value, profile, '2012-09-30'::date
+ SELECT LOWER(email), MD5(RANDOM()::TEXT), LOWER(email), first_given_name, family_name, home_ou, 2, ident_value, profile, '2012-09-30'::date
FROM scratchpad.usr_staging WHERE ident_value IN (
SELECT ident_value
FROM scratchpad.usr_staging
search_scope = ldap.SCOPE_SUBTREE
ldap_filter = '(&(objectclass=lulEduPerson))'
ldap_filter = '(&(objectclass=lulEduPerson)(lulPrimaryAffiliation=*)(createTimestamp>=%s000000Z))' % create_date
- ldap_filter = '(&(lulStudentLevel=*)(createTimestamp>=%s000000Z))' % create_date
+ ldap_filter = '(&(lulStudentLevel=*))'
try:
result_id = con.search(base_dn, search_scope, ldap_filter, attributes)
usrname = result_data['cn'][0].strip()
email = result_data['mail'][0].strip()
family_name = result_data['sn'][0].strip()
- given_name = result_data['givenName'][0].strip()
datatel = result_data['lulColleagueId'][0].strip()
+ if 'givenName' in result_data:
+ given_name = result_data['givenName'][0].strip()
+ else:
+ given_name = 'LDAP_NULL'
+ print >> sys.stderr, 'No givenName for %s' % (usrname)
+
if len(datatel) != 7:
print >> sys.stderr, 'Datatel number not 7 chars for %s (%s)' % (usrname, datatel)
if len(datatel) == 6: