apache / whimsy

Apache Whimsy
Apache License 2.0
74 stars 70 forks source link

Person.method_missing only works properly for required attributes #180

Closed sebbASF closed 1 year ago

sebbASF commented 1 year ago

The following code: https://github.com/apache/whimsy/blob/e30d6166c0e9711ed8b99e7ade9488bac0356b8b/lib/whimsy/asf/ldap.rb#L873

relies on being able to detect the presence of the attribute in the LDAP record.

However, LDAP does not return the names of missing attributes, in which case rather than returning nil, the method raises an error: 'undefined method attributename for ...'. This means that (e.g.) githubUsername may work as an object property for some people but not others. This is confusing.

Furthermore, if the Person object does not correspond to an LDAP record, even required attributes raise errors.