Commit ec3e3267 authored by Nicolas Delaby's avatar Nicolas Delaby

Update user management, remove useless LOGs

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15754 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 037b246e
...@@ -1037,7 +1037,7 @@ class Subscription(Folder, SyncCode): ...@@ -1037,7 +1037,7 @@ class Subscription(Folder, SyncCode):
if callable(gid_gen): if callable(gid_gen):
o_gid = gid_gen(object) o_gid = gid_gen(object)
else: else:
raise ValueError, "The conduit "+conduit_name+"seems to no have a \ raise ValueError, "The conduit "+conduit_name+"seems to not have a \
getGidFromObject method and it must" getGidFromObject method and it must"
# elif getattr(o_base, gid_gen, None) is not None: # elif getattr(o_base, gid_gen, None) is not None:
# generator = getattr(object, gid_gen) # generator = getattr(object, gid_gen)
......
...@@ -31,6 +31,7 @@ from Subscription import Subscription,Signature ...@@ -31,6 +31,7 @@ from Subscription import Subscription,Signature
from XMLSyncUtils import XMLSyncUtils, Parse from XMLSyncUtils import XMLSyncUtils, Parse
import commands import commands
from Conduit.ERP5Conduit import ERP5Conduit from Conduit.ERP5Conduit import ERP5Conduit
from AccessControl import getSecurityManager
from DateTime import DateTime from DateTime import DateTime
from zLOG import LOG, DEBUG, INFO from zLOG import LOG, DEBUG, INFO
...@@ -46,8 +47,7 @@ class SubscriptionSynchronization(XMLSyncUtils): ...@@ -46,8 +47,7 @@ class SubscriptionSynchronization(XMLSyncUtils):
subscription.initLastMessageId() subscription.initLastMessageId()
#save the actual user to use it in all the session: #save the actual user to use it in all the session:
user = self.portal_membership.getAuthenticatedMember().getUserName() user = getSecurityManager().getUser()
LOG('SubSyncInit, user saved :',DEBUG, user)
subscription.setZopeUser(user) subscription.setZopeUser(user)
subscription.setAuthenticated(True) subscription.setAuthenticated(True)
......
...@@ -979,13 +979,11 @@ class SynchronizationTool( SubscriptionSynchronization, ...@@ -979,13 +979,11 @@ class SynchronizationTool( SubscriptionSynchronization,
This will try to synchronize every subscription This will try to synchronize every subscription
""" """
message_list = self.portal_activities.getMessageList() message_list = self.portal_activities.getMessageList()
LOG('sync, message_list:', DEBUG, message_list) LOG('sync, len(message_list):', DEBUG, len(message_list))
if len(message_list) == 0: if len(message_list) == 0:
for subscription in self.getSubscriptionList(): for subscription in self.getSubscriptionList():
user = subscription.getZopeUser() user = subscription.getZopeUser()
LOG('sync, user :',DEBUG, user)
newSecurityManager(None, user) newSecurityManager(None, user)
LOG('sync, type(subcription):', DEBUG, type(subscription))
self.activate(activity='RAMQueue').SubSync(subscription.getPath()) self.activate(activity='RAMQueue').SubSync(subscription.getPath())
security.declarePublic('readResponse') security.declarePublic('readResponse')
......
...@@ -798,7 +798,7 @@ class XMLSyncUtilsMixin(SyncCode): ...@@ -798,7 +798,7 @@ class XMLSyncUtilsMixin(SyncCode):
local_gid_list = map(lambda x: domain.getGidFromObject(x),object_list) local_gid_list = map(lambda x: domain.getGidFromObject(x),object_list)
# Objects to remove # Objects to remove
LOG('remove object to remove ...', DEBUG, '') LOG('getSyncMLData remove object to remove ...', DEBUG, '')
object_gid_deleted = [] object_gid_deleted = []
for object_gid in subscriber.getGidList(): for object_gid in subscriber.getGidList():
if object_gid not in local_gid_list: if object_gid not in local_gid_list:
...@@ -827,6 +827,7 @@ class XMLSyncUtilsMixin(SyncCode): ...@@ -827,6 +827,7 @@ class XMLSyncUtilsMixin(SyncCode):
if max is not None and loop >= max: if max is not None and loop >= max:
result['finished'] = 0 result['finished'] = 0
break break
LOG('getSyncMLData object_path', DEBUG, object_path)
object = self.unrestrictedTraverse(object_path) object = self.unrestrictedTraverse(object_path)
status = self.SENT status = self.SENT
object_gid = domain.getGidFromObject(object) object_gid = domain.getGidFromObject(object)
...@@ -1449,7 +1450,7 @@ class XMLSyncUtils(XMLSyncUtilsMixin): ...@@ -1449,7 +1450,7 @@ class XMLSyncUtils(XMLSyncUtilsMixin):
cmd_id = result['cmd_id'] cmd_id = result['cmd_id']
return self.sendSyncModif(syncml_data, cmd_id_before_getsyncmldata, return self.sendSyncModif(syncml_data, cmd_id_before_getsyncmldata,
subscriber, domain, xml_confirmation, subscriber, domain, xml_confirmation,
remote_xml, xml_list, has_status_list, remote_xml, xml_list, has_status_list,
has_response) has_response)
def SyncModifActivity(self, **kw): def SyncModifActivity(self, **kw):
...@@ -1521,7 +1522,7 @@ class XMLSyncUtils(XMLSyncUtilsMixin): ...@@ -1521,7 +1522,7 @@ class XMLSyncUtils(XMLSyncUtilsMixin):
domain=domain, domain=domain,
content_type=domain.getSyncContentType()) content_type=domain.getSyncContentType())
if syncml_data == '': if syncml_data == '':
LOG('this is the end of the synchronisation session !!!', DEBUG, '') LOG('this is the end of the synchronisation session !!!', INFO, '')
subscriber.setAuthenticated(False) subscriber.setAuthenticated(False)
domain.setAuthenticated(False) domain.setAuthenticated(False)
has_response = 1 has_response = 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment