Commit 4d32c239 authored by Jérome Perrin's avatar Jérome Perrin

extends the role cloning tool to be able to clone to a portal type group

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34848 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8634dcf3
...@@ -57,6 +57,15 @@ ...@@ -57,6 +57,15 @@
cb_data = context.manage_copyObjects(\n cb_data = context.manage_copyObjects(\n
ids=[r.getId() for r in context.contentValues(portal_type=\'Role Information\')])\n ids=[r.getId() for r in context.contentValues(portal_type=\'Role Information\')])\n
\n \n
if portal_type_group_list:\n
for ti in context.portal_types.contentValues():\n
if ti == context or ti.getId() in portal_type_list:\n
continue\n
for group in ti.getTypeGroupList():\n
if group in portal_type_group_list:\n
portal_type_list.append(ti.getId())\n
break\n
\n
for ti in portal_type_list:\n for ti in portal_type_list:\n
destination_portal_type = context.portal_types[ti]\n destination_portal_type = context.portal_types[ti]\n
if remove_existing_roles:\n if remove_existing_roles:\n
...@@ -66,7 +75,8 @@ for ti in portal_type_list:\n ...@@ -66,7 +75,8 @@ for ti in portal_type_list:\n
destination_portal_type.manage_pasteObjects(cb_data)\n destination_portal_type.manage_pasteObjects(cb_data)\n
\n \n
return context.Base_redirect(form_id,\n return context.Base_redirect(form_id,\n
keep_items=dict(portal_status_message=translateString(\'Roles copied\')))\n keep_items=dict(portal_status_message=translateString(\'Roles copied in ${type_list}\',\n
mapping=dict(type_list=\', \'.join(portal_type_list)))))\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -77,7 +87,7 @@ return context.Base_redirect(form_id,\n ...@@ -77,7 +87,7 @@ return context.Base_redirect(form_id,\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>remove_existing_roles, portal_type_list, form_id=\'view\'</string> </value> <value> <string>remove_existing_roles, portal_type_list, portal_type_group_list, form_id=\'view\', **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -97,7 +107,7 @@ return context.Base_redirect(form_id,\n ...@@ -97,7 +107,7 @@ return context.Base_redirect(form_id,\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>3</int> </value> <value> <int>4</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -105,7 +115,9 @@ return context.Base_redirect(form_id,\n ...@@ -105,7 +115,9 @@ return context.Base_redirect(form_id,\n
<tuple> <tuple>
<string>remove_existing_roles</string> <string>remove_existing_roles</string>
<string>portal_type_list</string> <string>portal_type_list</string>
<string>portal_type_group_list</string>
<string>form_id</string> <string>form_id</string>
<string>kw</string>
<string>Products.ERP5Type.Message</string> <string>Products.ERP5Type.Message</string>
<string>translateString</string> <string>translateString</string>
<string>_getattr_</string> <string>_getattr_</string>
...@@ -116,6 +128,7 @@ return context.Base_redirect(form_id,\n ...@@ -116,6 +128,7 @@ return context.Base_redirect(form_id,\n
<string>r</string> <string>r</string>
<string>cb_data</string> <string>cb_data</string>
<string>ti</string> <string>ti</string>
<string>group</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>destination_portal_type</string> <string>destination_portal_type</string>
<string>dict</string> <string>dict</string>
......
...@@ -96,6 +96,7 @@ ...@@ -96,6 +96,7 @@
<key> <string>left</string> </key> <key> <string>left</string> </key>
<value> <value>
<list> <list>
<string>your_portal_type_group_list</string>
<string>your_portal_type_list</string> <string>your_portal_type_list</string>
<string>your_remove_existing_roles</string> <string>your_remove_existing_roles</string>
</list> </list>
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>required</string> </key> <key> <string>required</string> </key>
<value> <int>1</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
......
579 580
\ No newline at end of file \ 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