1 # copyright 2011-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
1 # copyright 2011-2015 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
3 # |
3 # |
4 # This file is part of CubicWeb. |
4 # This file is part of CubicWeb. |
5 # |
5 # |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
98 def handle_deletion(self, config, cnx, myuris): |
98 def handle_deletion(self, config, cnx, myuris): |
99 if config['delete-entities']: |
99 if config['delete-entities']: |
100 super(DataFeedLDAPAdapter, self).handle_deletion(config, cnx, myuris) |
100 super(DataFeedLDAPAdapter, self).handle_deletion(config, cnx, myuris) |
101 return |
101 return |
102 if myuris: |
102 if myuris: |
103 byetype = {} |
|
104 for extid, (eid, etype) in myuris.items(): |
103 for extid, (eid, etype) in myuris.items(): |
105 if self.is_deleted(extid, etype, eid): |
104 if etype != 'CWUser' or not self.is_deleted(extid, etype, eid): |
106 byetype.setdefault(etype, []).append(str(eid)) |
|
107 |
|
108 for etype, eids in byetype.items(): |
|
109 if etype != 'CWUser': |
|
110 continue |
105 continue |
111 self.info('deactivate %s %s entities', len(eids), etype) |
106 self.info('deactivate user %s', eid) |
112 for eid in eids: |
107 wf = cnx.entity_from_eid(eid).cw_adapt_to('IWorkflowable') |
113 wf = cnx.entity_from_eid(eid).cw_adapt_to('IWorkflowable') |
108 wf.fire_transition_if_possible('deactivate') |
114 wf.fire_transition_if_possible('deactivate') |
|
115 cnx.commit() |
109 cnx.commit() |
116 |
110 |
117 def update_if_necessary(self, entity, attrs): |
111 def update_if_necessary(self, entity, attrs): |
118 # disable read security to allow password selection |
112 # disable read security to allow password selection |
119 with entity._cw.security_enabled(read=False): |
113 with entity._cw.security_enabled(read=False): |