Commit 681ccd50 authored by Rafael Monnerat's avatar Rafael Monnerat

Update local roles from all objects introduced by this business erp5_demo_maxma_sample

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44956 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9d793daf
......@@ -56,55 +56,12 @@ from Products.ERP5Type.Log import log\n
\n
portal = context.getPortalObject()\n
portal_preferences = portal.portal_preferences\n
business_template = context.portal_templates.getInstalledBusinessTemplate("erp5_demo_maxma_sample")\n
bt = context.portal_templates.getInstalledBusinessTemplate("erp5_demo_maxma_sample")\n
N_ = context.Base_translateString\n
isTransitionPossible = portal.portal_workflow.isTransitionPossible\n
\n
if business_template is not None:\n
# update role settings for modules which exists already\n
for portal_type in business_template.getTemplatePortalTypeRolesList():\n
module_list = portal.contentValues(\n
filter=dict(portal_type=portal_type))\n
for module in module_list:\n
module.updateLocalRolesOnSecurityGroups()\n
print "Updated Role Mappings for: %s(%s) " %(module.getTitle(), module.getPortalType())\n
\n
# update path items. FIXME: local roles should be exported by business template instead\n
for path in business_template.getTemplatePathList():\n
obj = portal.restrictedTraverse(path, None)\n
# no need to update security on categories\n
if obj is not None and obj.getPortalType() not in (\'Category\', \'Base Category\',):\n
obj.updateLocalRolesOnSecurityGroups()\n
print "Updated Role Mappings for: ", path, obj.getPortalType()\n
\n
# validate and open all objects\n
for path in business_template.getTemplatePathList():\n
obj = context.getPortalObject().restrictedTraverse(path, None)\n
if obj is not None and hasattr(obj, \'getPortalType\'):\n
if obj.getPortalType() in (\'Person\',\n
\'Organisation\',\n
\'Business Process\',\n
\'Account\',\n
\'Service\', \'Product\',\n
\'Sale Trade Condition\',\n
\'Purchase Trade Condition\'\n
\'Order Root Simulation Rule\',\n
\'Delivery Root Simulation Rule\'\n
\'Trade Model Simulation Rule\',\n
\'Accounting Transaction Root Simulation Rule\',\n
\'Invoice Transaction Simulation Rule\',\n
\'Payment Simulation Rule\',\n
\'Invoice Root Simulation Rule\',\n
\'Delivery Simulation Rule\',\n
\'Invoice Simulation Rule\'):\n
\n
for period in obj.contentValues(filter={\'portal_type\':\'Accounting Period\'}):\n
period.updateLocalRolesOnSecurityGroups()\n
print "\\tOpen (Accounting Period): ", period.getRelativeUrl()\n
\n
for assignment in obj.contentValues(filter={\'portal_type\':\'Assignment\'}):\n
assignment.updateLocalRolesOnSecurityGroups()\n
print "\\tOpen (assignment): ", assignment.getRelativeUrl()\n
for obj in context.portal_catalog(path=["%%/%s" % i.replace("**", "%") for i in bt.getTemplatePathList()]):\n
obj.activate().updateLocalRolesOnSecurityGroups()\n
\n
for gadget in context.portal_gadgets.objectValues():\n
if gadget.getValidationState() == \'invisible\':\n
......
15
\ No newline at end of file
16
\ 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