diff --git a/product/ERP5SyncML/Subscription.py b/product/ERP5SyncML/Subscription.py
index f50798b9b4951d77c6c06b6df00ef77a5f45f1ee..3d793f6995f7c6c4f8dbfe9125aa9ac6241495fa 100644
--- a/product/ERP5SyncML/Subscription.py
+++ b/product/ERP5SyncML/Subscription.py
@@ -999,6 +999,18 @@ class Subscription(Folder, SyncCode):
     """
     self.password = new_password
 
+  def getZopeUser(self):
+    """
+    This method return the zope user who begin the synchronization session
+    """
+    return getattr(self, 'zope_user_name', None)
+
+  def setZopeUser(self, user_name):
+    """
+    This method set the zope user_name
+    """
+    self.zope_user_name = user_name
+
   def getAuthenticationFormat(self):
     """
       return the format of authentication
@@ -1052,6 +1064,9 @@ class Subscription(Folder, SyncCode):
     This tries to get the object with the given gid
     This uses the query if it exist
     """
+    #if len(gid)%2 != 0:
+    #something encode in base 16 is always a even number of number
+    #  return None
     signature = self.getSignatureFromGid(gid)
     # First look if we do already have the mapping between
     # the id and the gid
diff --git a/product/ERP5SyncML/SubscriptionSynchronization.py b/product/ERP5SyncML/SubscriptionSynchronization.py
index 581326736abd0258f47c8b82adb9ed41c6885cab..79d00487580a3aeb195da4094c6d4c96692862e4 100644
--- a/product/ERP5SyncML/SubscriptionSynchronization.py
+++ b/product/ERP5SyncML/SubscriptionSynchronization.py
@@ -44,6 +44,13 @@ class SubscriptionSynchronization(XMLSyncUtils):
     cmd_id = 1 # specifies a SyncML message-unique command identifier
     subscription.NewAnchor()
     subscription.initLastMessageId()
+
+    #save the actual user to use it in all the session:
+    user = self.portal_membership.getAuthenticatedMember().getUserName()
+    LOG('SubSyncInit, user saved :',DEBUG, user)
+    subscription.setZopeUser(user)
+    subscription.setAuthenticated(True)
+
     xml_list = []
     xml = xml_list.append
     xml('<SyncML>\n')
diff --git a/product/ERP5SyncML/SynchronizationTool.py b/product/ERP5SyncML/SynchronizationTool.py
index f9cbe52606b1b523a71ee6aaba1ccf763a82aeaa..4c0516dedc84aab6957b4377a79be7b95618427c 100644
--- a/product/ERP5SyncML/SynchronizationTool.py
+++ b/product/ERP5SyncML/SynchronizationTool.py
@@ -984,6 +984,9 @@ class SynchronizationTool( SubscriptionSynchronization,
     LOG('sync, message_list:', DEBUG, message_list)
     if len(message_list) == 0:
       for subscription in self.getSubscriptionList():
+        user = subscription.getZopeUser()
+        LOG('sync, user :',DEBUG, user)
+        newSecurityManager(None, user)
         LOG('sync, type(subcription):', DEBUG, type(subscription))
         self.activate(activity='RAMQueue').SubSync(subscription.getPath())
 
@@ -1001,6 +1004,7 @@ class SynchronizationTool( SubscriptionSynchronization,
       # the id sync_id, this is not so good, but there is no way yet
       # to know if we will call a publication or subscription XXX
       gpg_key = ''
+      LOG('readResponse, sync_id :', DEBUG, sync_id)
       for publication in self.getPublicationList():
         if publication.getTitle() == sync_id:
           gpg_key = publication.getGPGKey()
@@ -1010,6 +1014,9 @@ class SynchronizationTool( SubscriptionSynchronization,
           if subscription.getTitle() == sync_id:
             gpg_key = subscription.getGPGKey()
             domain = subscription
+            user = domain.getZopeUser()
+            LOG('readResponse, user :', DEBUG, user)
+            newSecurityManager(None, user)
       # decrypt the message if needed
       if gpg_key not in (None,''):
         filename = str(random.randrange(1, 2147483600)) + '.txt'
diff --git a/product/ERP5SyncML/XMLSyncUtils.py b/product/ERP5SyncML/XMLSyncUtils.py
index 68c26223de0bea3a7022e40941f1307f529bc4d0..0e057816e625ec95b938aad47399b830d6d0416a 100644
--- a/product/ERP5SyncML/XMLSyncUtils.py
+++ b/product/ERP5SyncML/XMLSyncUtils.py
@@ -1241,6 +1241,7 @@ class XMLSyncUtilsMixin(SyncCode):
           elif status_code in (self.SUCCESS, self.ITEM_ADDED):
             signature.setStatus(self.SYNCHRONIZED)
         elif status_cmd == 'Delete':
+          has_status_list = 1
           if status_code == self.SUCCESS:
             signature = subscriber.getSignatureFromGid(object_gid) or \
             subscriber.getSignatureFromRid(object_gid)
@@ -1494,11 +1495,14 @@ class XMLSyncUtils(XMLSyncUtilsMixin):
                 xml=xml_a,
                 domain=domain,
                 content_type=domain.getSyncContentType())
+      if syncml_data == '':
+        LOG('this is the end of the synchronisation session !!!', DEBUG, '')
+        subscriber.setAuthenticated(False)
+        domain.setAuthenticated(False)
       has_response = 1
     elif domain.domain_type == self.SUB:
       if self.checkAlert(remote_xml) or \
-          (xml_confirmation,syncml_data) != ('','') or \
-          has_status_list:
+          (xml_confirmation,syncml_data) != ('',''):
         subscriber.setLastSentMessage(xml_a)
         self.sendResponse(
                   from_url=domain.subscription_url,
@@ -1507,6 +1511,9 @@ class XMLSyncUtils(XMLSyncUtilsMixin):
                   xml=xml_a,domain=domain,
                   content_type=domain.getSyncContentType())
         has_response = 1
+      else:
+        LOG('this is the end of the synchronisation session !!!', DEBUG, '')
+        domain.setAuthenticated(False)
     return {'has_response':has_response,'xml':xml_a}
 
   def xml2wbxml(self, xml):