Commit c9be703f authored by Sebastien Robin's avatar Sebastien Robin

added the management of group roles


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@473 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 009a39f9
......@@ -229,7 +229,10 @@ class ERP5Conduit(XMLSyncUtilsMixin):
LOG('local_role: ',0,'user: %s roles: %s' % (repr(user),repr(roles)))
#user = roles[0]
#roles = roles[1:]
object.manage_setLocalRoles(user,roles)
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:
conflict_list += self.updateNode(xml=xml,object=object, force=force,
simulate=simulate, **kw)
......@@ -280,7 +283,10 @@ class ERP5Conduit(XMLSyncUtilsMixin):
# We want to del a local role
user = self.getAttribute(xml,'id')
LOG('local_role: ',0,'user: %s' % repr(user))
object.manage_delLocalRoles([user])
if xml.nodeName.find(self.local_role_tag)>=0:
object.manage_delLocalRoles([user])
elif xml.nodeName.find(self.local_group_tag)>=0:
object.manage_delLocalGroupRoles([user])
return conflict_list
security.declareProtected(Permissions.ModifyPortalContent, 'updateNode')
......
......@@ -71,8 +71,8 @@ class SyncCode(Persistent):
action_tag = 'workflow_action'
NOT_EDITABLE_PROPERTY = ('id','object','uid','xupdate:element',action_tag,
'xupdate:attribute','local_role')
#NOT_EDITABLE_PROPERTY = ('id','object','uid','xupdate:element',action_tag,
# 'xupdate:attribute','local_role')
XUPDATE_INSERT = ('xupdate:insert-after','xupdate:insert-before')
XUPDATE_ADD = ('xupdate:append',)
XUPDATE_DEL = ('xupdate:remove',)
......@@ -91,8 +91,12 @@ class SyncCode(Persistent):
#history_tag = 'workflow_history'
history_tag = 'workflow_action'
local_role_tag = 'local_role'
local_role_list = (local_role_tag,'/'+local_role_tag)
ADDABLE_PROPERTY = (local_role_tag,history_tag)
local_group_tag = 'local_group'
local_role_list = (local_role_tag,'/'+local_role_tag,
local_group_tag,'/'+local_group_tag)
ADDABLE_PROPERTY = local_role_list + (history_tag,)
NOT_EDITABLE_PROPERTY = ('id','object','uid','xupdate:attribute') \
+ XUPDATE_EL + ADDABLE_PROPERTY
sub_object_exp = "/object\[@id='.*'\]/"
object_exp = "/object\[@id='.*'\]"
sub_sub_object_exp = "/object\[@id='.*'\]/object\[@id='.*'\]/"
......
......@@ -129,12 +129,14 @@ def Base_asXML(object, ident=0):
# We should now describe security settings
for user_role in self.get_local_roles():
xml += ident_string + ' <local_role id="%s" type="tokens">' % user_role[0]
#xml += '@@@'.join(map(lambda x: str(x),toto))
xml += '@@@'.join(user_role[1])
#for role in user_role[1]:
# xml += '@@@'
# xml += '%s' % role
xml += '</local_role>\n'
# Sometimes theres is roles specified for groups, like with CPS
if hasattr(self,'get_local_group_roles'):
for group_role in self.get_local_group_roles():
xml += ident_string + ' <local_group id="%s" type="tokens">' % group_role[0]
xml += '@@@'.join(group_role[1])
xml += '</local_group>\n'
# We have finished to generate the xml
xml += ident_string + '</object>\n'
......
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