Commit 10c59883 authored by Benjamin Blanc's avatar Benjamin Blanc

erp5_scalability_data: Fix updat roles scalability script

parent 5ea01b81
......@@ -51,13 +51,34 @@
<item>
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
portal_types = portal.searchFolder(title=\'portal_types\')[0]\n
role_name_list = [\'Assignor\', \'Assignee\', \'Associate\', \'Auditor\', \'Author\']\n
role_category_list = [\'group/my_group\']\n
\n
# Update roles of Product, Organisation and Sale Trade Condition\n
portal_type = portal.searchFolder(title=\'portal_types\')[0]\n
portal_type.searchFolder(title=\'Product\')[0].updateRoleMapping()\n
portal_type.searchFolder(title=\'Person\')[0].updateRoleMapping()\n
portal_type.searchFolder(title=\'Organisation\')[0].updateRoleMapping()\n
portal_type.searchFolder(title=\'Sale Trade Condition\')[0].updateRoleMapping()\n
role_list = [\'Product\', \'Product Module\', \'Person\', \'Person Module\', \n
\'Organisation\', \'Organisation Module\', \'Sale Trade Condition\',\n
\'Sale Trade Condition Module\', \'Web Page Module\', \'Sale Order Module\']\n
\n
\n
for role in role_list:\n
\n
# Get portal type\n
current_portal = portal_types.searchFolder(title={\'query\':role, \'key\':\'ExactMatch\'})[0]\n
\n
# Delete existing role informations\n
id_list = [x.getId() for x in current_portal.searchFolder(portal_type=\'Role Information\')]\n
current_portal.manage_delObjects(id_list)\n
\n
# Create new role information\n
current_portal.newContent(\n
portal_type = \'Role Information\',\n
title = \'Default\',\n
role_name_list = role_name_list,\n
role_category_list = role_category_list,\n
description = \'Configured by Scalability script\'\n
)\n
# Update roles\n
current_portal.updateRoleMapping()\n
\n
return 1\n
</string> </value>
......
21
\ No newline at end of file
22
\ 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