diff --git a/master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Payzen%20Event.xml b/master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Payzen%20Event.xml new file mode 100644 index 0000000000000000000000000000000000000000..4126cb5fb341cb72960756acae18c665d72ee893 --- /dev/null +++ b/master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Payzen%20Event.xml @@ -0,0 +1,13 @@ +<type_roles> + <role id='Assignor'> + <property id='title'>Group company</property> + <multi_property id='category'>group/company</multi_property> + <multi_property id='base_category'>group</multi_property> + </role> + <role id='Auditor'> + <property id='title'>Shadow User</property> + <property id='condition'>python: here.getDestinationSection('', portal_type='Person') != ''</property> + <property id='base_category_script'>PaymentTransactionType_getSecurityCategoryFromUser</property> + <multi_property id='base_category'>aggregate</multi_property> + </role> +</type_roles> \ No newline at end of file diff --git a/master/bt5/slapos_erp5/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml b/master/bt5/slapos_erp5/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml index 62379902037c94143b2ae036ef902acccb828e93..7f50142c093dc73fb1bec7734b1b7560e3cac921 100644 --- a/master/bt5/slapos_erp5/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml +++ b/master/bt5/slapos_erp5/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml @@ -19,6 +19,10 @@ <type>Payment Transaction</type> <workflow>local_permission_slapos_interaction_workflow</workflow> </chain> + <chain> + <type>Payzen Event</type> + <workflow>local_permission_slapos_interaction_workflow</workflow> + </chain> <chain> <type>Person</type> <workflow>local_permission_slapos_interaction_workflow</workflow> diff --git a/master/bt5/slapos_erp5/TestTemplateItem/testSlapOSERP5GroupRoleSecurity.py b/master/bt5/slapos_erp5/TestTemplateItem/testSlapOSERP5GroupRoleSecurity.py index db1e5a0c186164724670a23291700d3875624a3f..263a1aabc9b7dfe451db679626ad0505fc58bf82 100644 --- a/master/bt5/slapos_erp5/TestTemplateItem/testSlapOSERP5GroupRoleSecurity.py +++ b/master/bt5/slapos_erp5/TestTemplateItem/testSlapOSERP5GroupRoleSecurity.py @@ -1417,3 +1417,30 @@ class TestSystemEventModule(TestSlapOSGroupRoleSecurityMixin): self.assertRoles(module, 'R-SHADOW-PERSON', ['Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'ERP5TypeTestCase', ['Owner']) + +class TestPayzenEvent(TestSlapOSGroupRoleSecurityMixin): + def test_GroupCompany(self): + product = self.portal.system_event_module.newContent( + portal_type='Payzen Event') + product.updateLocalRolesOnSecurityGroups() + self.assertSecurityGroup(product, + ['G-COMPANY', self.user_id], False) + self.assertRoles(product, 'G-COMPANY', ['Assignor']) + self.assertRoles(product, self.user_id, ['Owner']) + + def test_ShadowUser(self): + reference = 'TESTPERSON-%s' % self.generateNewId() + person = self.portal.person_module.newContent(portal_type='Person', + reference=reference) + product = self.portal.system_event_module.newContent( + portal_type='Payzen Event') + product.edit( + destination_section_value=person, + ) + product.updateLocalRolesOnSecurityGroups() + shadow_reference = 'SHADOW-%s' % reference + self.assertSecurityGroup(product, + ['G-COMPANY', self.user_id, shadow_reference], False) + self.assertRoles(product, 'G-COMPANY', ['Assignor']) + self.assertRoles(product, shadow_reference, ['Auditor']) + self.assertRoles(product, self.user_id, ['Owner']) diff --git a/master/bt5/slapos_erp5/TestTemplateItem/testSlapOSERP5LocalPermissionSlapOSInteractionWorkflow.py b/master/bt5/slapos_erp5/TestTemplateItem/testSlapOSERP5LocalPermissionSlapOSInteractionWorkflow.py index a6b2abd2679af9193198eddc78f6cb85d7553079..f7ba1441cf01055eb39078ca29f4b10e3a45c2cc 100644 --- a/master/bt5/slapos_erp5/TestTemplateItem/testSlapOSERP5LocalPermissionSlapOSInteractionWorkflow.py +++ b/master/bt5/slapos_erp5/TestTemplateItem/testSlapOSERP5LocalPermissionSlapOSInteractionWorkflow.py @@ -277,3 +277,19 @@ class TestSlapOSLocalPermissionSlapOSInteractionWorkflow( self.assertSecurityGroup(payment_transaction, [self.user_id, 'G-COMPANY', 'SHADOW-%s' % self.person_user.getReference()], False) + + def test_PayzenEvent_setDestinationSection(self): + self._makePerson() + payment_transaction = self.portal.system_event_module.newContent( + portal_type='Payzen Event') + self.assertSecurityGroup(payment_transaction, [self.user_id, + 'G-COMPANY'], + False) + + payment_transaction.edit( + destination_section=self.person_user.getRelativeUrl()) + transaction.commit() + + self.assertSecurityGroup(payment_transaction, [self.user_id, + 'G-COMPANY', 'SHADOW-%s' % self.person_user.getReference()], + False) diff --git a/master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/local_permission_slapos_interaction_workflow/interactions/PayzenEvent_edit.xml b/master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/local_permission_slapos_interaction_workflow/interactions/PayzenEvent_edit.xml new file mode 100644 index 0000000000000000000000000000000000000000..367b58656fbac5075da22a32aadd8fb31d447be8 --- /dev/null +++ b/master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/local_permission_slapos_interaction_workflow/interactions/PayzenEvent_edit.xml @@ -0,0 +1,96 @@ +<?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> + <list> + <string>Base_updateAllLocalRoles</string> + </list> + </value> + </item> + <item> + <key> <string>before_commit_script_name</string> </key> + <value> + <tuple/> + </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>PayzenEvent_edit</string> </value> + </item> + <item> + <key> <string>method_id</string> </key> + <value> + <list> + <string>_setDestinationSection.*</string> + </list> + </value> + </item> + <item> + <key> <string>once_per_transaction</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>portal_type_filter</string> </key> + <value> + <list> + <string>Payzen Event</string> + </list> + </value> + </item> + <item> + <key> <string>script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>temporary_document_disallowed</string> </key> + <value> <int>1</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> diff --git a/master/bt5/slapos_erp5/bt/revision b/master/bt5/slapos_erp5/bt/revision index dd1ec209f3358043353ec9054f1d3bf3416d325e..af2132305d02d9a2bd40d240aba087a616dc79bf 100644 --- a/master/bt5/slapos_erp5/bt/revision +++ b/master/bt5/slapos_erp5/bt/revision @@ -1 +1 @@ -132 \ No newline at end of file +133 \ No newline at end of file diff --git a/master/bt5/slapos_erp5/bt/template_portal_type_role_list b/master/bt5/slapos_erp5/bt/template_portal_type_role_list index 690f531c10ef8fe74860e94455ba6348991c5672..fccc4078b17f77316c5be5f823b3be279717bb63 100644 --- a/master/bt5/slapos_erp5/bt/template_portal_type_role_list +++ b/master/bt5/slapos_erp5/bt/template_portal_type_role_list @@ -58,6 +58,7 @@ Organisation Organisation Module PDF Payment Transaction +Payzen Event Person Person Module Phone Call diff --git a/master/bt5/slapos_erp5/bt/template_portal_type_roles_list b/master/bt5/slapos_erp5/bt/template_portal_type_roles_list index 690f531c10ef8fe74860e94455ba6348991c5672..d3d95a351e262cf261a80ba27ce882795b9dfbfc 100644 --- a/master/bt5/slapos_erp5/bt/template_portal_type_roles_list +++ b/master/bt5/slapos_erp5/bt/template_portal_type_roles_list @@ -1,5 +1,6 @@ Account Account Module +Payzen Event Accounting Period Accounting Transaction Accounting Transaction Module diff --git a/master/bt5/slapos_erp5/bt/template_portal_type_workflow_chain_list b/master/bt5/slapos_erp5/bt/template_portal_type_workflow_chain_list index 3f01db9695594ac4ed4f1cc4bf3872e823c8fe53..3d5487775366b675172f194503fcd786a914de82 100644 --- a/master/bt5/slapos_erp5/bt/template_portal_type_workflow_chain_list +++ b/master/bt5/slapos_erp5/bt/template_portal_type_workflow_chain_list @@ -3,6 +3,7 @@ Computer Network | local_permission_slapos_interaction_workflow Computer | local_permission_slapos_interaction_workflow Hosting Subscription | local_permission_slapos_interaction_workflow Payment Transaction | local_permission_slapos_interaction_workflow +Payzen Event | local_permission_slapos_interaction_workflow Person | local_permission_slapos_interaction_workflow Slave Instance | local_permission_slapos_interaction_workflow Software Installation | local_permission_slapos_interaction_workflow diff --git a/master/bt5/slapos_incubation/PortalTypeRolesTemplateItem/Payzen%20Event.xml b/master/bt5/slapos_incubation/PortalTypeRolesTemplateItem/Payzen%20Event.xml deleted file mode 100644 index 4d9464e68e6e0373f788aedf864f5ed657fe8e09..0000000000000000000000000000000000000000 --- a/master/bt5/slapos_incubation/PortalTypeRolesTemplateItem/Payzen%20Event.xml +++ /dev/null @@ -1,7 +0,0 @@ -<type_roles> - <role id='Author'> - <property id='title'>Member</property> - <multi_property id='category'>role/member</multi_property> - <multi_property id='base_category'>role</multi_property> - </role> -</type_roles> \ No newline at end of file diff --git a/master/bt5/slapos_incubation/bt/revision b/master/bt5/slapos_incubation/bt/revision index f11c82a4cb6cc2e8f3bdf52b5cdeaad4d5bb214e..9a037142aa3c1b4c490e1a38251620f113465330 100644 --- a/master/bt5/slapos_incubation/bt/revision +++ b/master/bt5/slapos_incubation/bt/revision @@ -1 +1 @@ -9 \ No newline at end of file +10 \ No newline at end of file diff --git a/master/bt5/slapos_incubation/bt/template_portal_type_role_list b/master/bt5/slapos_incubation/bt/template_portal_type_role_list index f30b76a2c8e31f326a231fbe2a363b7a4c5c0b44..b07195244b6f4877fbabeb4d10e3373a1586ac8b 100644 --- a/master/bt5/slapos_incubation/bt/template_portal_type_role_list +++ b/master/bt5/slapos_incubation/bt/template_portal_type_role_list @@ -1,3 +1,2 @@ Business Process -Business Process Module -Payzen Event \ No newline at end of file +Business Process Module \ No newline at end of file diff --git a/master/bt5/slapos_incubation/bt/template_portal_type_roles_list b/master/bt5/slapos_incubation/bt/template_portal_type_roles_list index f30b76a2c8e31f326a231fbe2a363b7a4c5c0b44..b07195244b6f4877fbabeb4d10e3373a1586ac8b 100644 --- a/master/bt5/slapos_incubation/bt/template_portal_type_roles_list +++ b/master/bt5/slapos_incubation/bt/template_portal_type_roles_list @@ -1,3 +1,2 @@ Business Process -Business Process Module -Payzen Event \ No newline at end of file +Business Process Module \ No newline at end of file diff --git a/master/bt5/slapos_payzen/PortalTypeBaseCategoryTemplateItem/base_category_list.xml b/master/bt5/slapos_payzen/PortalTypeBaseCategoryTemplateItem/base_category_list.xml index a1637599048b2cedebe0126f275c6891c171cc19..b3ecf89504f05f0008e1bfe4b5bbabe23e499859 100644 --- a/master/bt5/slapos_payzen/PortalTypeBaseCategoryTemplateItem/base_category_list.xml +++ b/master/bt5/slapos_payzen/PortalTypeBaseCategoryTemplateItem/base_category_list.xml @@ -1,6 +1,7 @@ <base_category_list> <portal_type id="Payzen Event"> <item>destination</item> + <item>destination_section</item> <item>source</item> </portal_type> <portal_type id="Payzen Event Message"> diff --git a/master/bt5/slapos_payzen/bt/revision b/master/bt5/slapos_payzen/bt/revision index a46c9d2265d70e913acb0e0935a4cd167ac4773c..69226f7293aa543649b73a6ed3264cddabfcd8c1 100644 --- a/master/bt5/slapos_payzen/bt/revision +++ b/master/bt5/slapos_payzen/bt/revision @@ -1 +1 @@ -91 \ No newline at end of file +92 \ No newline at end of file diff --git a/master/bt5/slapos_payzen/bt/template_portal_type_base_category_list b/master/bt5/slapos_payzen/bt/template_portal_type_base_category_list index 6775f6fdb1150bfdd9d3c313be896d918d5c7502..ce8a6541c7603d46d93f32eddb979a2ef490cc60 100644 --- a/master/bt5/slapos_payzen/bt/template_portal_type_base_category_list +++ b/master/bt5/slapos_payzen/bt/template_portal_type_base_category_list @@ -1,3 +1,4 @@ Payzen Event Message | predecessor Payzen Event | destination +Payzen Event | destination_section Payzen Event | source \ No newline at end of file