server/sources/ldapuser.py
branchstable
changeset 5789 0f969e5c579a
parent 5646 c9550c1239f0
child 5800 2bc88fb424bc
equal deleted inserted replaced
5786:7c16a4e7a592 5789:0f969e5c579a
   518                              eid, base)
   518                              eid, base)
   519                 entity = session.entity_from_eid(eid, 'CWUser')
   519                 entity = session.entity_from_eid(eid, 'CWUser')
   520                 self.repo.delete_info(session, entity, self.uri, base)
   520                 self.repo.delete_info(session, entity, self.uri, base)
   521                 self.reset_cache()
   521                 self.reset_cache()
   522             return []
   522             return []
   523 ##         except ldap.REFERRAL, e:
   523         # except ldap.REFERRAL, e:
   524 ##             cnx = self.handle_referral(e)
   524         #     cnx = self.handle_referral(e)
   525 ##             try:
   525         #     try:
   526 ##                 res = cnx.search_s(base, scope, searchstr, attrs)
   526         #         res = cnx.search_s(base, scope, searchstr, attrs)
   527 ##             except ldap.PARTIAL_RESULTS:
   527         #     except ldap.PARTIAL_RESULTS:
   528 ##                 res_type, res = cnx.result(all=0)
   528         #         res_type, res = cnx.result(all=0)
   529         result = []
   529         result = []
   530         for rec_dn, rec_dict in res:
   530         for rec_dn, rec_dict in res:
   531             # When used against Active Directory, "rec_dict" may not be
   531             # When used against Active Directory, "rec_dict" may not be
   532             # be a dictionary in some cases (instead, it can be a list)
   532             # be a dictionary in some cases (instead, it can be a list)
   533             # An example of a useless "res" entry that can be ignored
   533             # An example of a useless "res" entry that can be ignored
   551                     rec_dict[key] = value = value[0]
   551                     rec_dict[key] = value = value[0]
   552             rec_dict['dn'] = rec_dn
   552             rec_dict['dn'] = rec_dn
   553             self._cache[rec_dn] = rec_dict
   553             self._cache[rec_dn] = rec_dict
   554             result.append(rec_dict)
   554             result.append(rec_dict)
   555         #print '--->', result
   555         #print '--->', result
   556         self.info('ldap built results %s', result)
   556         self.info('ldap built results %s', len(result))
   557         return result
   557         return result
   558 
   558 
   559     def before_entity_insertion(self, session, lid, etype, eid):
   559     def before_entity_insertion(self, session, lid, etype, eid):
   560         """called by the repository when an eid has been attributed for an
   560         """called by the repository when an eid has been attributed for an
   561         entity stored here but the entity has not been inserted in the system
   561         entity stored here but the entity has not been inserted in the system