Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_workflow
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenjie.zheng
erp5_workflow
Commits
a11f3572
Commit
a11f3572
authored
May 20, 2015
by
wenjie.zheng
Committed by
Sebastien Robin
Jul 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_configurator_ung: add workflow after script.
parent
02feb039
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
166 additions
and
0 deletions
+166
-0
bt5/erp5_configurator_ung/WorkflowTemplateItem/portal_workflow/workflow_ung_configuration_workflow.xml
...m/portal_workflow/workflow_ung_configuration_workflow.xml
+4
-0
bt5/erp5_configurator_ung/WorkflowTemplateItem/portal_workflow/workflow_ung_configuration_workflow/BusinessConfiguration_afterUNGConfiguration.xml
..._workflow/BusinessConfiguration_afterUNGConfiguration.xml
+162
-0
No files found.
bt5/erp5_configurator_ung/WorkflowTemplateItem/portal_workflow/workflow_ung_configuration_workflow.xml
View file @
a11f3572
...
...
@@ -53,6 +53,10 @@
<key>
<string>
comment
</string>
</key>
<value>
<string>
The default UNG configuration workflow.
</string>
</value>
</item>
<item>
<key>
<string>
configuration_after_script_id
</string>
</key>
<value>
<string>
BusinessConfiguration_afterUNGConfiguration
</string>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
ung_configuration_workflow
</string>
</value>
...
...
bt5/erp5_configurator_ung/WorkflowTemplateItem/portal_workflow/workflow_ung_configuration_workflow/BusinessConfiguration_afterUNGConfiguration.xml
0 → 100644
View file @
a11f3572
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Workflow Script"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
""" This script will be called to apply the customization. """\n
from AccessControl import getSecurityManager\n
\n
portal = context.getPortalObject()\n
portal_preferences = portal.portal_preferences\n
business_template = context.getSpecialiseValue()\n
isTransitionPossible = portal.portal_workflow.isTransitionPossible\n
\n
# enable ung preference\n
ung_preference = getattr(portal.portal_preferences, \'ung_preference\', None)\n
if ung_preference is not None and isTransitionPossible(ung_preference, \'enable\'):\n
ung_preference.enable()\n
\n
# publish the ung web site\n
ung_web_site = getattr(portal.web_site_module, \'ung\', None)\n
if ung_web_site is not None and isTransitionPossible(ung_web_site, \'publish\', None):\n
ung_web_site.publish()\n
\n
language = context.getGlobalConfigurationAttr("default_available_language")\n
\n
ung_web_site.setDefaultAvailableLanguage(language)\n
for web_section in ung_web_site.contentValues(portal_types=\'Web Section\'):\n
if isTransitionPossible(web_section, \'publish\', None):\n
web_section.publish()\n
\n
bt5 = portal.portal_catalog.getResultValue(portal_type="Business Template",\n
title="erp5_web_ung_role")\n
\n
if bt5 is not None:\n
for portal_type in bt5.getTemplatePortalTypeRoleList():\n
module_list = portal.contentValues(filter=dict(portal_type=portal_type))\n
portal_type_object = portal.portal_catalog.getResultValue(portal_type="Base Type",\n
id=portal_type)\n
portal_type_object.updateRoleMapping()\n
context.log("Updated Role Mappings for: %s " % (portal_type_object.getId()))\n
for module in module_list:\n
module.updateLocalRolesOnSecurityGroups()\n
context.log("Updated Role Mappings for: %s(%s) " % (module.getTitle(), module.getPortalType()))\n
\n
if business_template is not None:\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
context.log("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
# XXX This hardcoded list is a bit inconvinient.\n
if obj.getPortalType() in (\'Person\', \n
\'Organisation\'):\n
if isTransitionPossible(obj, \'validate\'):\n
obj.validate()\n
context.log("Validated: ", obj.getRelativeUrl())\n
\n
for assignment in obj.contentValues(filter={\'portal_type\':\'Assignment\'}):\n
if isTransitionPossible(assignment, \'open\'):\n
assignment.open()\n
assignment.updateLocalRolesOnSecurityGroups()\n
context.log("\\tOpen (assignment): ", assignment.getRelativeUrl())\n
\n
for gadget in context.portal_gadgets.objectValues():\n
if gadget.getValidationState() == \'invisible\':\n
gadget.visible()\n
gadget.public()\n
\n
# XXX - check if is possible add this configuration in bt5\n
portal.knowledge_pad_module.manage_permission(\'Add portal content\',\n
roles=[\'Assignor\', "Manager", "Authenticated", "Author"],\n
acquire=0)\n
context.log("Indexing translations")\n
portal.ERP5Site_updateTranslationTable()\n
\n
# clear cache so user security is recalculated\n
portal.portal_caches.clearAllCache()\n
context.log("Clear cache.")\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
BusinessConfiguration_afterUNGConfiguration
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Workflow Script
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
After UNG Configuration
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment