server/sources/ldapuser.py
branchstable
changeset 7815 2a164a9cf81c
parent 7697 ef50074a0314
child 7884 35d2e2f4e10a
equal deleted inserted replaced
7814:1ec9fe1dfba9 7815:2a164a9cf81c
   271     def get_connection(self):
   271     def get_connection(self):
   272         """open and return a connection to the source"""
   272         """open and return a connection to the source"""
   273         if self._conn is None:
   273         if self._conn is None:
   274             try:
   274             try:
   275                 self._connect()
   275                 self._connect()
   276             except:
   276             except Exception:
   277                 self.exception('unable to connect to ldap:')
   277                 self.exception('unable to connect to ldap:')
   278         return ConnectionWrapper(self._conn)
   278         return ConnectionWrapper(self._conn)
   279 
   279 
   280     def authenticate(self, session, login, password=None, **kwargs):
   280     def authenticate(self, session, login, password=None, **kwargs):
   281         """return CWUser eid for the given login/password if this account is
   281         """return CWUser eid for the given login/password if this account is
   568             for key, value in items: # XXX syt: huuum ?
   568             for key, value in items: # XXX syt: huuum ?
   569                 if not isinstance(value, str):
   569                 if not isinstance(value, str):
   570                     try:
   570                     try:
   571                         for i in range(len(value)):
   571                         for i in range(len(value)):
   572                             value[i] = unicode(value[i], 'utf8')
   572                             value[i] = unicode(value[i], 'utf8')
   573                     except:
   573                     except Exception:
   574                         pass
   574                         pass
   575                 if isinstance(value, list) and len(value) == 1:
   575                 if isinstance(value, list) and len(value) == 1:
   576                     rec_dict[key] = value = value[0]
   576                     rec_dict[key] = value = value[0]
   577             rec_dict['dn'] = rec_dn
   577             rec_dict['dn'] = rec_dn
   578             self._cache[rec_dn] = rec_dict
   578             self._cache[rec_dn] = rec_dict