Commit e241bacb authored by Kevin Deldycke's avatar Kevin Deldycke

Creation of the addLocalRoleNode() independant function to handle the local roles processing.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1031 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 695b350f
...@@ -183,17 +183,7 @@ class ERP5Conduit(XMLSyncUtilsMixin): ...@@ -183,17 +183,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
conflict_list += self.addWorkflowNode(object, xml, simulate) conflict_list += self.addWorkflowNode(object, xml, simulate)
#elif xml.nodeName in self.local_role_list or self.isLocalRole(xml)>0 and not simulate: #elif xml.nodeName in self.local_role_list or self.isLocalRole(xml)>0 and not simulate:
elif xml.nodeName in self.local_role_list: elif xml.nodeName in self.local_role_list:
# We want to add a local role conflict_list += self.addLocalRoleNode(object, xml)
roles = self.convertXmlValue(xml.childNodes[0].data,data_type='tokens')
user = self.getAttribute(xml,'id')
roles = list(roles) # Needed for CPS, or we have a CPS error
LOG('local_role: ',0,'user: %s roles: %s' % (repr(user),repr(roles)))
#user = roles[0]
#roles = roles[1:]
if xml.nodeName.find(self.local_role_tag)>=0:
object.manage_setLocalRoles(user,roles)
elif xml.nodeName.find(self.local_group_tag)>=0:
object.manage_setLocalGroupRoles(user,roles)
else: else:
conflict_list += self.updateNode(xml=xml,object=object, force=force, conflict_list += self.updateNode(xml=xml,object=object, force=force,
simulate=simulate, **kw) simulate=simulate, **kw)
...@@ -1005,6 +995,26 @@ class ERP5Conduit(XMLSyncUtilsMixin): ...@@ -1005,6 +995,26 @@ class ERP5Conduit(XMLSyncUtilsMixin):
# return wf_conflict_list # return wf_conflict_list
return conflict_list return conflict_list
security.declareProtected(Permissions.ModifyPortalContent, 'addLocalRoleNode')
def addLocalRoleNode(self, object, xml):
"""
This allows to specify how to handle the local role informations.
This is really usefull if you want to write your own Conduit.
"""
conflict_list = []
# We want to add a local role
roles = self.convertXmlValue(xml.childNodes[0].data,data_type='tokens')
user = self.getAttribute(xml,'id')
roles = list(roles) # Needed for CPS, or we have a CPS error
LOG('local_role: ',0,'user: %s roles: %s' % (repr(user),repr(roles)))
#user = roles[0]
#roles = roles[1:]
if xml.nodeName.find(self.local_role_tag)>=0:
object.manage_setLocalRoles(user,roles)
elif xml.nodeName.find(self.local_group_tag)>=0:
object.manage_setLocalGroupRoles(user,roles)
return conflict_list
security.declareProtected(Permissions.ModifyPortalContent, 'editDocument') security.declareProtected(Permissions.ModifyPortalContent, 'editDocument')
def editDocument(self, object=None, **kw): def editDocument(self, object=None, **kw):
""" """
......
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