Modify LDAP script so that it doesn't raise an error when we don't get a record back from LDAP.
We now return an empty dictionary
This commit is contained in:
parent
dd67a5e650
commit
428802b9d0
|
@ -51,7 +51,16 @@ supervisor_info = ldap(supervisor_uid) // Sets the supervisor information to l
|
||||||
uid = UserService.current_user().uid
|
uid = UserService.current_user().uid
|
||||||
else:
|
else:
|
||||||
uid = args[0]
|
uid = args[0]
|
||||||
|
|
||||||
|
try:
|
||||||
user_info = LdapService.user_info(uid)
|
user_info = LdapService.user_info(uid)
|
||||||
|
except ApiError as ae:
|
||||||
|
app.logger.info(ae)
|
||||||
|
return {}
|
||||||
|
except Exception as e:
|
||||||
|
app.logger.info(e)
|
||||||
|
return {}
|
||||||
|
else:
|
||||||
user_info_dict = {
|
user_info_dict = {
|
||||||
"display_name": user_info.display_name,
|
"display_name": user_info.display_name,
|
||||||
"given_name": user_info.given_name,
|
"given_name": user_info.given_name,
|
||||||
|
@ -64,5 +73,4 @@ supervisor_info = ldap(supervisor_uid) // Sets the supervisor information to l
|
||||||
"uid": user_info.uid,
|
"uid": user_info.uid,
|
||||||
"proper_name": user_info.proper_name()
|
"proper_name": user_info.proper_name()
|
||||||
}
|
}
|
||||||
|
|
||||||
return user_info_dict
|
return user_info_dict
|
||||||
|
|
Loading…
Reference in New Issue