|
|
|
@ -30,15 +30,12 @@ for csc_entry in csc_conn.entries: |
|
|
|
|
cn = csc_entry.cn.value |
|
|
|
|
sn = None |
|
|
|
|
given_name = None |
|
|
|
|
try: |
|
|
|
|
uw_conn.search( |
|
|
|
|
f'uid={uid},{UWLDAP_MEMBERS_BASE}', '(objectClass=*)', |
|
|
|
|
attributes=['sn', 'givenName'], search_scope=ldap3.BASE) |
|
|
|
|
uw_conn.search( |
|
|
|
|
UWLDAP_MEMBERS_BASE, f'(uid={uid})', attributes=['sn', 'givenName']) |
|
|
|
|
if uw_conn.entries: |
|
|
|
|
uw_entry = uw_conn.entries[0] |
|
|
|
|
sn = uw_entry.sn.value |
|
|
|
|
given_name = uw_entry.givenName.value |
|
|
|
|
except ldap3.core.exceptions.LDAPNoSuchObjectResult: |
|
|
|
|
pass |
|
|
|
|
if given_name is None or sn is None: |
|
|
|
|
print(f'WARNING: could not retrieve first and last names for {uid}; inferring from whitespace instead') |
|
|
|
|
words = cn.split() |
|
|
|
|