Commit 61ab87d4 authored by Romain Courteaud's avatar Romain Courteaud

Give user view permission on his subscription pl.

parent ce45a47b
...@@ -4,4 +4,10 @@ ...@@ -4,4 +4,10 @@
<multi_property id='category'>group/company</multi_property> <multi_property id='category'>group/company</multi_property>
<multi_property id='base_category'>group</multi_property> <multi_property id='base_category'>group</multi_property>
</role> </role>
<role id='Auditor'>
<property id='title'>Subscription Customer</property>
<property id='condition'>python: here.getSpecialise() == 'sale_trade_condition_module/slapos_subscription_trade_condition'</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='base_category'>destination_decision</multi_property>
</role>
</type_roles> </type_roles>
\ No newline at end of file
...@@ -39,6 +39,10 @@ ...@@ -39,6 +39,10 @@
<type>Sale Invoice Transaction</type> <type>Sale Invoice Transaction</type>
<workflow>local_permission_slapos_interaction_workflow</workflow> <workflow>local_permission_slapos_interaction_workflow</workflow>
</chain> </chain>
<chain>
<type>Sale Packing List</type>
<workflow>local_permission_slapos_interaction_workflow</workflow>
</chain>
<chain> <chain>
<type>Slave Instance</type> <type>Slave Instance</type>
<workflow>local_permission_slapos_interaction_workflow</workflow> <workflow>local_permission_slapos_interaction_workflow</workflow>
......
...@@ -829,6 +829,23 @@ class TestSalePackingList(TestSlapOSGroupRoleSecurityMixin): ...@@ -829,6 +829,23 @@ class TestSalePackingList(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(product, 'G-COMPANY', ['Assignor']) self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, self.user_id, ['Owner']) self.assertRoles(product, self.user_id, ['Owner'])
def test_GroupCustomerSubscription(self):
reference = 'TESTPERSON-%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
product = self.portal.sale_packing_list_module.newContent(
portal_type='Sale Packing List',
destination_decision_value=person,
specialise_value=self.portal.sale_trade_condition_module.\
slapos_subscription_trade_condition,
)
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', self.user_id, reference], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, self.user_id, ['Owner'])
self.assertRoles(product, reference, ['Auditor'])
class TestAccountingTransactionModule(TestSlapOSGroupRoleSecurityMixin): class TestAccountingTransactionModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.accounting_module module = self.portal.accounting_module
......
...@@ -588,3 +588,31 @@ class TestSlapOSLocalPermissionSlapOSInteractionWorkflow( ...@@ -588,3 +588,31 @@ class TestSlapOSLocalPermissionSlapOSInteractionWorkflow(
self.assertSecurityGroup(event, ['G-COMPANY', self.user_id, self.assertSecurityGroup(event, ['G-COMPANY', self.user_id,
self.person_reference], False) self.person_reference], False)
def test_SalePackingList_setSpecialise(self):
self._makePerson()
sale_packing_list = self.portal.sale_packing_list_module.newContent(
destination_decision_value=self.person_user,
portal_type='Sale Packing List')
self.assertSecurityGroup(sale_packing_list, ['G-COMPANY', self.user_id], False)
sale_packing_list.edit(
specialise="sale_trade_condition_module/slapos_subscription_trade_condition")
transaction.commit()
self.assertSecurityGroup(sale_packing_list, ['G-COMPANY', self.user_id,
self.person_reference], False)
def test_SalePackingList_setDestinationDecision(self):
self._makePerson()
sale_packing_list = self.portal.sale_packing_list_module.newContent(
specialise="sale_trade_condition_module/slapos_subscription_trade_condition",
portal_type='Sale Packing List')
self.assertSecurityGroup(sale_packing_list, ['G-COMPANY', self.user_id], False)
sale_packing_list.edit(
destination_decision_value=self.person_user)
transaction.commit()
self.assertSecurityGroup(sale_packing_list, ['G-COMPANY', self.user_id,
self.person_reference], False)
<?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>SalePackingList_edit</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>_setDestinationDecision.*</string>
<string>_setSpecialise.*</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>Sale Packing List</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>
159 160
\ No newline at end of file \ No newline at end of file
...@@ -8,6 +8,7 @@ Payment Transaction | local_permission_slapos_interaction_workflow ...@@ -8,6 +8,7 @@ Payment Transaction | local_permission_slapos_interaction_workflow
Payzen Event | local_permission_slapos_interaction_workflow Payzen Event | local_permission_slapos_interaction_workflow
Person | local_permission_slapos_interaction_workflow Person | local_permission_slapos_interaction_workflow
Sale Invoice Transaction | local_permission_slapos_interaction_workflow Sale Invoice Transaction | local_permission_slapos_interaction_workflow
Sale Packing List | local_permission_slapos_interaction_workflow
Slave Instance | local_permission_slapos_interaction_workflow Slave Instance | local_permission_slapos_interaction_workflow
Software Installation | local_permission_slapos_interaction_workflow Software Installation | local_permission_slapos_interaction_workflow
Software Instance | local_permission_slapos_interaction_workflow Software Instance | local_permission_slapos_interaction_workflow
\ 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