Commit 1b522293 authored by Romain Courteaud's avatar Romain Courteaud

[officejs_security] Update Software Publication/Product security

Owner must be able to view his product

Revert "[officejs_security] Allow officejs user to see validated product"
This reverts commit 4e8a490f.

Drop not needed category value

[officejs_upgrader] Set person value on the Software Product
This allows to correctly set the local roles during an upgrade.
parent 1f66b123
<type_roles> <type_roles>
<role id='Auditor'>
<property id='title'>Author - Developer</property>
<property id='description'>Developers should have access to their Software Product</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='base_category'>source</multi_property>
</role>
<role id='Assignor; Assignee; Associate; Auditor; Author'> <role id='Assignor; Assignee; Associate; Auditor; Author'>
<property id='title'>Default</property> <property id='title'>Default</property>
<property id='description'>Configured by ERP5 Configurator</property> <property id='description'>Configured by ERP5 Configurator</property>
<multi_property id='category'>group/my_group</multi_property> <multi_property id='category'>group/my_group</multi_property>
</role> </role>
<role id='Auditor'>
<property id='title'>Role Author</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='category'>role/author</multi_property>
<multi_property id='base_category'>source</multi_property>
</role>
</type_roles> </type_roles>
\ No newline at end of file
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
<property id='title'>Author - Developer</property> <property id='title'>Author - Developer</property>
<property id='description'>Developers should have access to their Software Publication</property> <property id='description'>Developers should have access to their Software Publication</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='category'>role/author</multi_property>
<multi_property id='base_category'>source</multi_property> <multi_property id='base_category'>source</multi_property>
</role> </role>
<role id='Assignor; Assignee; Associate; Auditor; Author'> <role id='Assignor; Assignee; Associate; Auditor; Author'>
......
...@@ -3,4 +3,12 @@ ...@@ -3,4 +3,12 @@
<type>Person</type> <type>Person</type>
<workflow>officejs_security_interaction_workflow</workflow> <workflow>officejs_security_interaction_workflow</workflow>
</chain> </chain>
<chain>
<type>Software Product</type>
<workflow>officejs_security_interaction_workflow</workflow>
</chain>
<chain>
<type>Software Publication</type>
<workflow>officejs_security_interaction_workflow</workflow>
</chain>
</workflow_chain> </workflow_chain>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="InteractionDefinition" module="Products.ERP5.Interaction"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>activate_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>before_commit_script_name</string> </key>
<value>
<list>
<string>Base_updateAllLocalRoles</string>
</list>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SoftwareXXX_edit</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>_setSource.*</string>
</list>
</value>
</item>
<item>
<key> <string>once_per_transaction</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type_filter</string> </key>
<value>
<list>
<string>Software Product</string>
<string>Software Publication</string>
</list>
</value>
</item>
<item>
<key> <string>portal_type_group_filter</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>temporary_document_disallowed</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Person | officejs_security_interaction_workflow Person | officejs_security_interaction_workflow
Software Product | officejs_security_interaction_workflow
Software Publication | officejs_security_interaction_workflow
\ No newline at end of file
...@@ -2,4 +2,7 @@ ...@@ -2,4 +2,7 @@
<portal_type id="Preference Tool"> <portal_type id="Preference Tool">
<item>PreferenceToolAppstoreConstraint</item> <item>PreferenceToolAppstoreConstraint</item>
</portal_type> </portal_type>
<portal_type id="Software Product">
<item>SoftwareProductAppstoreConstraint</item>
</portal_type>
</property_sheet_list> </property_sheet_list>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Property Sheet" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SoftwareProductAppstoreConstraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Property Sheet</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Script Constraint" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>constraint_type/post_upgrade</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SourcePerson Existence_constraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Script Constraint</string> </value>
</item>
<item>
<key> <string>script_id</string> </key>
<value> <string>SoftwareProduct_checkSourcePersonExistenceConsistency</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
software_product = context
error_list = []
person = software_product.getSourceValue(portal_type='Person')
if person is None:
error_list.append('No source defined')
if fixit:
software_publication_line = software_product.getResourceRelatedValue(portal_type='Software Publication Line')
if software_publication_line is not None:
person = software_publication_line.getParentValue().getSourceValue(portal_type='Person')
if person is not None:
software_product.edit(source_value=person)
# Migrate all software publication at the same time
for software_publication_line in software_product.getResourceRelatedValueList(portal_type='Software Publication Line'):
software_publication_line.getParentValue().updateLocalRolesOnSecurityGroups()
return error_list
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</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>_params</string> </key>
<value> <string>fixit=False</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SoftwareProduct_checkSourcePersonExistenceConsistency</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Preference Tool | PreferenceToolAppstoreConstraint Preference Tool | PreferenceToolAppstoreConstraint
Software Product | SoftwareProductAppstoreConstraint
\ No newline at end of file
PreferenceToolAppstoreConstraint PreferenceToolAppstoreConstraint
SoftwareProductAppstoreConstraint
\ 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