← Back to team overview

openerp-community team mailing list archive

Re: [Merge] lp:~ibeardslee/openobject-addons/users_ldap-tls into lp:~openerp-community/openobject-addons/stefan-therp_lp794584

 

Hi Stefan,

I've started looking into moving the start_tls_s() into res_company_ldap.connect().  Aware that I am picking up Python while working on this, I thought I'd check on some things.

* initialize(uri) returns an LDAPObject object.
* res_company_ldap.connect() returns that object as 'conn'
* start_tls_s acts on that object and doesn't return an object.
* simple_bind_s does the same.

If we were to include the start_tls_s in with res_company_ldap.connect() we could probably try and do the same with the simple_bind_s statement that would follow it.

Things still seem to work properly when the conn.simple_bind_s(dn, password) statement in res_company_ldap.authenticate() is replaced with the conn.simple_bind_s(conf['ldap_binddn'] or '', conf['ldap_password'] or '') in res_company_ldap.query().

Would it be sane to use the following stanza in both res_company_ldap.authenticate() and res_company_ldap.query()?  Making them the same, and therefore hopefully making it easier for people following to recognise that both would need to be updated.

  conn = self.connect(conf)
  if conf['ldap_tls']:
      conn.start_tls_s()
  conn.simple_bind_s(conf['ldap_binddn'] or '',
                     conf['ldap_password'] or '')

or is there a smart way of add those 4 lines to res_company_ldap.connect()?

Is there something I'm overlooking?

Cheers,
Ian
-- 
https://code.launchpad.net/~ibeardslee/openobject-addons/users_ldap-tls/+merge/71131
Your team OpenERP Community is subscribed to branch lp:~openerp-community/openobject-addons/stefan-therp_lp794584.


References