On Tue, Apr 18, 2017 at 7:52 PM, Craig Russell <[email protected]> wrote: > Of course, Java would throw a NullPointerException but Ruby/Javascript don't > care.
Chuckle. This isn't so much a language feature as a bad design decision that happened to work out this time. LDAP is a query mechanism. ASF::Person.find creates an object that issues queries. In other words, ASF::Person.find doesn't itself do a query and never returns nil. This can be a PITA if you really want to know if the user exists. I now have an alternative that does return nil if the id doesn't exist in LDAP: ASF::Person['badactor']. > Thanks!!! > > Craig - Sam Ruby >> On Apr 18, 2017, at 4:10 PM, Sam Ruby <[email protected]> wrote: >> >> On Tue, Apr 18, 2017 at 3:34 PM, Craig Russell <[email protected]> >> wrote: >>> >>> So my proposal for changing the current behavior: >>> >>> If field 5 is disabled for any reason, verify that ldap is either missing >>> or banned. I don't see the need to distinguish these two cases. >> >> Looks like the code already works that way: >> >> ASF::Person.find('badactor').banned? >> => true >> >> So the following code should do what you are asking: >> >> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_apache_whimsy_commit_0be74d0f094ba735d11b8609ec64aafb20010ddd&d=DwIBaQ&c=RoP1YumCXCgaWHvlZYR8PQcxBKCX5YTpkKY057SbK10&r=DKWhdZdh69Kb6XA85A6vmYASgWIRD5RAywexyAJQArI&m=rhybZ1RAXU9MA8l6i3zRRJBO_5MUMQFU4-uC8_xh_bw&s=BeAWRc4JU5lApbe5XvZ73m1_bz5uchuMBM6XPMPSvNc&e= >> >> - Sam Ruby > > Craig L Russell > Secretary, Apache Software Foundation > [email protected] http://db.apache.org/jdo >
