fix first/last name script
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Max Erenberg 2021-11-07 01:12:49 -04:00
parent ed9893604f
commit 798510511f
1 changed files with 3 additions and 6 deletions

View File

@ -30,15 +30,12 @@ for csc_entry in csc_conn.entries:
cn =
sn = None
given_name = None
f'uid={uid},{UWLDAP_MEMBERS_BASE}', '(objectClass=*)',
attributes=['sn', 'givenName'], search_scope=ldap3.BASE)
UWLDAP_MEMBERS_BASE, f'(uid={uid})', attributes=['sn', 'givenName'])
if uw_conn.entries:
uw_entry = uw_conn.entries[0]
sn =
given_name = uw_entry.givenName.value
except ldap3.core.exceptions.LDAPNoSuchObjectResult:
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()