server/sources/ldapuser.py
branchstable
changeset 4719 aaed3f813ef8
parent 4716 55b6a3262071
child 4913 083b4d454192
equal deleted inserted replaced
4718:3dc3ad02d091 4719:aaed3f813ef8
   208                 # if no result found, _search automatically delete entity information
   208                 # if no result found, _search automatically delete entity information
   209                 res = self._search(session, extid, BASE)
   209                 res = self._search(session, extid, BASE)
   210                 if res:
   210                 if res:
   211                     ldapemailaddr = res[0].get(ldap_emailattr)
   211                     ldapemailaddr = res[0].get(ldap_emailattr)
   212                     if ldapemailaddr:
   212                     if ldapemailaddr:
   213                         rset = session.execute('EmailAddress X,A WHERE '
   213                         rset = session.execute('EmailAddress A WHERE '
   214                                                'U use_email X, U eid %(u)s',
   214                                                'U use_email X, U eid %(u)s',
   215                                                {'u': eid})
   215                                                {'u': eid})
   216                         ldapemailaddr = unicode(ldapemailaddr)
   216                         ldapemailaddr = unicode(ldapemailaddr)
   217                         for emaileid, emailaddr in rset:
   217                         for emailaddr, in rset:
   218                             if emailaddr == ldapemailaddr:
   218                             if emailaddr == ldapemailaddr:
   219                                 break
   219                                 break
   220                         else:
   220                         else:
   221                             self.info('updating email address of user %s to %s',
   221                             self.info('updating email address of user %s to %s',
   222                                       extid, ldapemailaddr)
   222                                       extid, ldapemailaddr)