Commit 87460b5e authored by Jérome Perrin's avatar Jérome Perrin

remove external method to clone roles, adapt ERP5Type_cloneRoleInformation to...

remove external method to clone roles, adapt ERP5Type_cloneRoleInformation to use BaseType_copyRoleList, and mark it as obsolete

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33719 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 99f83504
def cloneSecurity(self, from_id, to_id):
"""
This methods copies roles from portal_type
from_id to portal_type to_id
"""
s = ''
from_pt = self[from_id]
to_pt = [self[x] for x in to_id]
for pt in to_pt:
pt._roles = ()
for role in from_pt._roles:
pt.addRole(
role.getId(),
role.Description(),
role.Title(),
role.getCondition(),
'\n'.join(role.getCategory()) or '',
role.getBaseCategoryScript(),
' '.join(role.getBaseCategory()) or '',
)
s+='%s\n' % pt
return s
\ No newline at end of file
......@@ -53,18 +53,21 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>"""\n
A quite generic script to clone security settings amont portal types.\n
from_type - a portal type id\n
to_type_list - a list of target types\n
Uses external method\n
<value> <string>"""Obsolete compatibility script.\n
"""\n
from Products.ERP5Type.Log import log\n
log("Obsolete script, please use BaseType_copyRoleList instead")\n
\n
print \'cloning role information from\'\n
print from_type\n
if to_type_list == ():\n
to_type_list = (to_type,)\n
print context.cloneRoleInformation(context.portal_types, from_type, to_type_list)\n
\n
print "to", to_type_list\n
\n
context.portal_types[from_type].BaseType_copyRoleList(remove_existing_roles=True,\n
portal_type_list=to_type_list)\n
\n
return printed\n
</string> </value>
</item>
......@@ -107,8 +110,12 @@ return printed\n
<string>to_type</string>
<string>_print_</string>
<string>_print</string>
<string>Products.ERP5Type.Log</string>
<string>log</string>
<string>_getattr_</string>
<string>_getitem_</string>
<string>context</string>
<string>True</string>
</tuple>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>cloneSecurity</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>SecurityCloner</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>cloneRoleInformation</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Ext. method to clone role information among portal types</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
577
\ No newline at end of file
578
\ No newline at end of file
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