server/repository.py
branchstable
changeset 7884 35d2e2f4e10a
parent 7823 5f145462e041
child 7885 9454b7ef5ae4
equal deleted inserted replaced
7883:cd98785b4a84 7884:35d2e2f4e10a
  1104         """
  1104         """
  1105         # begin by inserting eid/type/source/extid into the entities table
  1105         # begin by inserting eid/type/source/extid into the entities table
  1106         hook.CleanupNewEidsCacheOp.get_instance(session).add_data(entity.eid)
  1106         hook.CleanupNewEidsCacheOp.get_instance(session).add_data(entity.eid)
  1107         self.system_source.add_info(session, entity, source, extid, complete)
  1107         self.system_source.add_info(session, entity, source, extid, complete)
  1108 
  1108 
  1109     def delete_info(self, session, entity, sourceuri, extid, scleanup=None):
  1109     def delete_info(self, session, entity, sourceuri, scleanup=None):
  1110         """called by external source when some entity known by the system source
  1110         """called by external source when some entity known by the system source
  1111         has been deleted in the external source
  1111         has been deleted in the external source
  1112         """
  1112         """
  1113         # mark eid as being deleted in session info and setup cache update
  1113         # mark eid as being deleted in session info and setup cache update
  1114         # operation
  1114         # operation
  1115         hook.CleanupDeletedEidsCacheOp.get_instance(session).add_data(entity.eid)
  1115         hook.CleanupDeletedEidsCacheOp.get_instance(session).add_data(entity.eid)
  1116         self._delete_info(session, entity, sourceuri, extid, scleanup)
  1116         self._delete_info(session, entity, sourceuri, scleanup)
  1117 
  1117 
  1118     def _delete_info(self, session, entity, sourceuri, extid, scleanup=None):
  1118     def _delete_info(self, session, entity, sourceuri, scleanup=None):
  1119         """delete system information on deletion of an entity:
  1119         """delete system information on deletion of an entity:
       
  1120 
  1120         * delete all remaining relations from/to this entity
  1121         * delete all remaining relations from/to this entity
       
  1122 
  1121         * call delete info on the system source which will transfer record from
  1123         * call delete info on the system source which will transfer record from
  1122           the entities table to the deleted_entities table
  1124           the entities table to the deleted_entities table
       
  1125 
       
  1126         When scleanup is specified, it's expected to be the source's eid, in
       
  1127         which case we'll specify the target's relation source so that this
       
  1128         source is ignored. E.g. we want to delete relations stored locally, as
       
  1129         the deletion information comes from the external source, it's its
       
  1130         responsability to have cleaned-up its own relations.
  1123         """
  1131         """
  1124         pendingrtypes = session.transaction_data.get('pendingrtypes', ())
  1132         pendingrtypes = session.transaction_data.get('pendingrtypes', ())
  1125         # delete remaining relations: if user can delete the entity, he can
  1133         # delete remaining relations: if user can delete the entity, he can
  1126         # delete all its relations without security checking
  1134         # delete all its relations without security checking
  1127         with security_enabled(session, read=False, write=False):
  1135         with security_enabled(session, read=False, write=False):