Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hamza
erp5
Commits
73480932
Commit
73480932
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_run_my_doc: add workflow after script.
parent
fb6148d4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
203 additions
and
0 deletions
+203
-0
bt5/erp5_configurator_run_my_doc/WorkflowTemplateItem/portal_workflow/workflow_run_my_doc_configuration_workflow.xml
...l_workflow/workflow_run_my_doc_configuration_workflow.xml
+4
-0
bt5/erp5_configurator_run_my_doc/WorkflowTemplateItem/portal_workflow/workflow_run_my_doc_configuration_workflow/BusinessConfiguration_afterRunMyDocConfiguration.xml
...flow/BusinessConfiguration_afterRunMyDocConfiguration.xml
+199
-0
No files found.
bt5/erp5_configurator_run_my_doc/WorkflowTemplateItem/portal_workflow/workflow_run_my_doc_configuration_workflow.xml
View file @
73480932
...
@@ -53,6 +53,10 @@
...
@@ -53,6 +53,10 @@
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
<value>
<string>
The default RunMyDoc configuration workflow.
</string>
</value>
<value>
<string>
The default RunMyDoc configuration workflow.
</string>
</value>
</item>
</item>
<item>
<key>
<string>
configuration_after_script_id
</string>
</key>
<value>
<string>
BusinessConfiguration_afterRunMyDocConfiguration
</string>
</value>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
run_my_doc_configuration_workflow
</string>
</value>
<value>
<string>
run_my_doc_configuration_workflow
</string>
</value>
...
...
bt5/erp5_configurator_run_my_doc/WorkflowTemplateItem/portal_workflow/workflow_run_my_doc_configuration_workflow/BusinessConfiguration_afterRunMyDocConfiguration.xml
0 → 100644
View file @
73480932
<?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 runmydoc preference\n
runmydoc_preference = getattr(portal.portal_preferences, \'runmydoc_preference\', None)\n
if runmydoc_preference is not None and isTransitionPossible(runmydoc_preference, \'enable\'):\n
runmydoc_preference.enable()\n
\n
# Access Front Tab enabled for everyone\n
for preference in context.portal_catalog(portal_type = \'Preference\'):\n
preference.setPreferredHtmlStyleAccessTab(1)\n
\n
"""\n
# publish the runmydoc web site\n
runmydoc_web_site = getattr(portal.web_site_module, \'runmydoc\', None)\n
if runmydoc_web_site is not None and isTransitionPossible(runmydoc_web_site, \'publish\', None):\n
runmydoc_web_site.publish()\n
"""\n
\n
language = context.getGlobalConfigurationAttr("default_available_language")\n
\n
"""\n
runmydoc_web_site.setDefaultAvailableLanguage(language)\n
for web_section in runmydoc_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_runmydoc_role")\n
\n
if bt5 is not None:\n
for portal_type in bt5.getTemplatePortalTypeRolesList():\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
# Add a tab and a gadget for everyone\n
from Products.ERP5Security.ERP5UserManager import getUserByLogin\n
portal = context.getPortalObject()\n
for person in context.person_module.objectValues():\n
user_name = person.getReference()\n
tag = \'%s_%s_%s\' %(user_name,\n
\'erp5_front\',\n
None)\n
activate_kw = {\'tag\': tag}\n
\n
knowledge_pad = context.knowledge_pad_module.newContent(\n
portal_type = \'Knowledge Pad\',\n
title = context.Base_translateString(\'Tab\'),\n
activate_kw = activate_kw)\n
\n
knowledge_pad.visible()\n
current_user = context.portal_membership.getAuthenticatedMember()\n
knowledge_pad.manage_setLocalRoles(userid=user_name, roles=[\'Owner\'])\n
knowledge_pad.manage_delLocalRoles([str(current_user)])\n
knowledge_pad.reindexObject()\n
\n
knowledge_box = knowledge_pad.newContent(portal_type=\'Knowledge Box\',\n
specialise=\'portal_gadgets/test_wizard_gadget\',\n
activate_kw=activate_kw\n
)\n
knowledge_box.visible()\n
knowledge_box.reindexObject()\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
\n
context.log("Reindexing objects and updating roles.")\n
context.BusinessConfiguration_reindexRunMyDocObjectsAndRoles()\n
context.log("Objects reindex and roles updates.")\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
alter_preferences=True
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
BusinessConfiguration_afterRunMyDocConfiguration
</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 RunMyDoc 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