sobjects/ldapparser.py
changeset 9879 21278eb03bbf
parent 9551 cbc46f94081d
child 10089 6346f53c85f1
equal deleted inserted replaced
9878:f3936f64bd98 9879:21278eb03bbf
    90             self._process('CWUser', userdict)
    90             self._process('CWUser', userdict)
    91         self.debug('processing ldapfeed source %s %s', self.source, self.searchgroupfilterstr)
    91         self.debug('processing ldapfeed source %s %s', self.source, self.searchgroupfilterstr)
    92         for groupdict in self.group_source_entities_by_extid.itervalues():
    92         for groupdict in self.group_source_entities_by_extid.itervalues():
    93             self._process('CWGroup', groupdict)
    93             self._process('CWGroup', groupdict)
    94 
    94 
    95     def handle_deletion(self, config, session, myuris):
    95     def handle_deletion(self, config, cnx, myuris):
    96         if config['delete-entities']:
    96         if config['delete-entities']:
    97             super(DataFeedLDAPAdapter, self).handle_deletion(config, session, myuris)
    97             super(DataFeedLDAPAdapter, self).handle_deletion(config, cnx, myuris)
    98             return
    98             return
    99         if myuris:
    99         if myuris:
   100             byetype = {}
   100             byetype = {}
   101             for extid, (eid, etype) in myuris.iteritems():
   101             for extid, (eid, etype) in myuris.iteritems():
   102                 if self.is_deleted(extid, etype, eid):
   102                 if self.is_deleted(extid, etype, eid):
   105             for etype, eids in byetype.iteritems():
   105             for etype, eids in byetype.iteritems():
   106                 if etype != 'CWUser':
   106                 if etype != 'CWUser':
   107                     continue
   107                     continue
   108                 self.info('deactivate %s %s entities', len(eids), etype)
   108                 self.info('deactivate %s %s entities', len(eids), etype)
   109                 for eid in eids:
   109                 for eid in eids:
   110                     wf = session.entity_from_eid(eid).cw_adapt_to('IWorkflowable')
   110                     wf = cnx.entity_from_eid(eid).cw_adapt_to('IWorkflowable')
   111                     wf.fire_transition_if_possible('deactivate')
   111                     wf.fire_transition_if_possible('deactivate')
   112         session.commit(free_cnxset=False)
   112         cnx.commit()
   113 
   113 
   114     def update_if_necessary(self, entity, attrs):
   114     def update_if_necessary(self, entity, attrs):
   115         # disable read security to allow password selection
   115         # disable read security to allow password selection
   116         with entity._cw.security_enabled(read=False):
   116         with entity._cw.security_enabled(read=False):
   117             entity.complete(tuple(attrs))
   117             entity.complete(tuple(attrs))