Commit af9079b2 authored by Romain Courteaud's avatar Romain Courteaud

slapos_erp5: Sale user can see Software Product and Instance Tree

parent 107d91ef
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
<role id='F-PRODUCTION*'> <role id='F-PRODUCTION*'>
<item>Auditor</item> <item>Auditor</item>
</role> </role>
<role id='F-SALE*'>
<item>Auditor</item>
</role>
<role id='R-COMPUTER'> <role id='R-COMPUTER'>
<item>Auditor</item> <item>Auditor</item>
</role> </role>
...@@ -23,6 +26,7 @@ ...@@ -23,6 +26,7 @@
<principal id='F-CUSTOMER'>Auditor</principal> <principal id='F-CUSTOMER'>Auditor</principal>
<principal id='F-CUSTOMER'>Author</principal> <principal id='F-CUSTOMER'>Author</principal>
<principal id='F-PRODUCTION*'>Auditor</principal> <principal id='F-PRODUCTION*'>Auditor</principal>
<principal id='F-SALE*'>Auditor</principal>
</local_role_group_id> </local_role_group_id>
</local_role_group_ids> </local_role_group_ids>
</local_roles_item> </local_roles_item>
\ No newline at end of file
...@@ -23,4 +23,10 @@ ...@@ -23,4 +23,10 @@
<multi_property id='category'>function/customer</multi_property> <multi_property id='category'>function/customer</multi_property>
<multi_property id='base_category'>function</multi_property> <multi_property id='base_category'>function</multi_property>
</role> </role>
<role id='Auditor'>
<property id='title'>Sale</property>
<multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>function/sale*</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
</type_roles> </type_roles>
\ No newline at end of file
...@@ -29,4 +29,10 @@ ...@@ -29,4 +29,10 @@
<multi_property id='categories'>local_role_group/subscription</multi_property> <multi_property id='categories'>local_role_group/subscription</multi_property>
<multi_property id='base_category'>aggregate</multi_property> <multi_property id='base_category'>aggregate</multi_property>
</role> </role>
<role id='Auditor'>
<property id='title'>Sale</property>
<multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>function/sale*</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
</type_roles> </type_roles>
\ No newline at end of file
...@@ -26,4 +26,10 @@ ...@@ -26,4 +26,10 @@
<multi_property id='category'>function/production/manager</multi_property> <multi_property id='category'>function/production/manager</multi_property>
<multi_property id='base_category'>follow_up</multi_property> <multi_property id='base_category'>follow_up</multi_property>
</role> </role>
<role id='Auditor'>
<property id='title'>Sale</property>
<multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>function/sale*</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
</type_roles> </type_roles>
\ No newline at end of file
...@@ -715,11 +715,12 @@ class TestInstanceTreeModule(TestSlapOSGroupRoleSecurityMixin): ...@@ -715,11 +715,12 @@ class TestInstanceTreeModule(TestSlapOSGroupRoleSecurityMixin):
def test_InstanceTreeModule(self): def test_InstanceTreeModule(self):
module = self.portal.instance_tree_module module = self.portal.instance_tree_module
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['F-PRODUCTION*', 'R-COMPUTER', 'F-CUSTOMER', 'R-INSTANCE', module.Base_getOwnerId()], False) ['F-PRODUCTION*', 'R-COMPUTER', 'F-CUSTOMER', 'F-SALE*', 'R-INSTANCE', module.Base_getOwnerId()], False)
self.assertRoles(module, 'F-CUSTOMER', ['Auditor', 'Author']) self.assertRoles(module, 'F-CUSTOMER', ['Auditor', 'Author'])
self.assertRoles(module, 'R-COMPUTER', ['Auditor']) self.assertRoles(module, 'R-COMPUTER', ['Auditor'])
self.assertRoles(module, 'R-INSTANCE', ['Auditor']) self.assertRoles(module, 'R-INSTANCE', ['Auditor'])
self.assertRoles(module, 'F-PRODUCTION*', ['Auditor']) self.assertRoles(module, 'F-PRODUCTION*', ['Auditor'])
self.assertRoles(module, 'F-SALE*', ['Auditor'])
self.assertRoles(module, module.Base_getOwnerId(), ['Owner']) self.assertRoles(module, module.Base_getOwnerId(), ['Owner'])
...@@ -730,9 +731,10 @@ class TestInstanceTree(TestSlapOSGroupRoleSecurityMixin): ...@@ -730,9 +731,10 @@ class TestInstanceTree(TestSlapOSGroupRoleSecurityMixin):
portal_type='Instance Tree') portal_type='Instance Tree')
subscription.edit(reference=reference) subscription.edit(reference=reference)
self.assertSecurityGroup(subscription, [self.user_id, reference], False) self.assertSecurityGroup(subscription, [self.user_id, 'F-SALE*', reference], False)
self.assertRoles(subscription, reference, ['Assignee']) self.assertRoles(subscription, reference, ['Assignee'])
self.assertRoles(subscription, self.user_id, ['Owner']) self.assertRoles(subscription, self.user_id, ['Owner'])
self.assertRoles(subscription, 'F-SALE*', ['Auditor'])
def test_InstanceTree_CustomOfTheInstanceTree(self): def test_InstanceTree_CustomOfTheInstanceTree(self):
customer_reference = 'TESTPERSON-%s' % self.generateNewId() customer_reference = 'TESTPERSON-%s' % self.generateNewId()
...@@ -744,9 +746,10 @@ class TestInstanceTree(TestSlapOSGroupRoleSecurityMixin): ...@@ -744,9 +746,10 @@ class TestInstanceTree(TestSlapOSGroupRoleSecurityMixin):
subscription.edit( subscription.edit(
destination_section_value=customer) destination_section_value=customer)
self.assertSecurityGroup(subscription, [self.user_id, reference, self.assertSecurityGroup(subscription, [self.user_id, 'F-SALE*', reference,
customer.getUserId()], False) customer.getUserId()], False)
self.assertRoles(subscription, reference, ['Assignee']) self.assertRoles(subscription, reference, ['Assignee'])
self.assertRoles(subscription, 'F-SALE*', ['Auditor'])
self.assertRoles(subscription, customer.getUserId(), ['Assignee']) self.assertRoles(subscription, customer.getUserId(), ['Assignee'])
self.assertRoles(subscription, self.user_id, ['Owner']) self.assertRoles(subscription, self.user_id, ['Owner'])
...@@ -759,11 +762,12 @@ class TestInstanceTree(TestSlapOSGroupRoleSecurityMixin): ...@@ -759,11 +762,12 @@ class TestInstanceTree(TestSlapOSGroupRoleSecurityMixin):
portal_type='Instance Tree', reference=reference) portal_type='Instance Tree', reference=reference)
subscription.edit( subscription.edit(
follow_up_value=project) follow_up_value=project)
self.assertSecurityGroup(subscription, [self.user_id, reference, self.assertSecurityGroup(subscription, [self.user_id, 'F-SALE*', reference,
'%s_F-PRODAGNT' % project.getReference(), '%s_F-PRODAGNT' % project.getReference(),
'%s_F-PRODMAN' % project.getReference()], False) '%s_F-PRODMAN' % project.getReference()], False)
self.assertRoles(subscription, reference, ['Assignee']) self.assertRoles(subscription, reference, ['Assignee'])
self.assertRoles(subscription, self.user_id, ['Owner']) self.assertRoles(subscription, self.user_id, ['Owner'])
self.assertRoles(subscription, 'F-SALE*', ['Auditor'])
self.assertRoles(subscription, '%s_F-PRODMAN' % project.getReference(), ['Assignor']) self.assertRoles(subscription, '%s_F-PRODMAN' % project.getReference(), ['Assignor'])
self.assertRoles(subscription, '%s_F-PRODAGNT' % project.getReference(), ['Assignee']) self.assertRoles(subscription, '%s_F-PRODAGNT' % project.getReference(), ['Assignee'])
...@@ -989,8 +993,9 @@ class TestSoftwareProduct(TestSlapOSGroupRoleSecurityMixin): ...@@ -989,8 +993,9 @@ class TestSoftwareProduct(TestSlapOSGroupRoleSecurityMixin):
product = self.portal.software_product_module.newContent( product = self.portal.software_product_module.newContent(
portal_type='Software Product') portal_type='Software Product')
self.assertSecurityGroup(product, self.assertSecurityGroup(product,
[self.user_id], False) [self.user_id, 'F-SALE*'], False)
self.assertRoles(product, self.user_id, ['Owner']) self.assertRoles(product, self.user_id, ['Owner'])
self.assertRoles(product, 'F-SALE*', ['Auditor'])
def test_SoftwareProduct_Project(self): def test_SoftwareProduct_Project(self):
project = self.addProject() project = self.addProject()
...@@ -999,10 +1004,12 @@ class TestSoftwareProduct(TestSlapOSGroupRoleSecurityMixin): ...@@ -999,10 +1004,12 @@ class TestSoftwareProduct(TestSlapOSGroupRoleSecurityMixin):
product.edit( product.edit(
follow_up_value=project) follow_up_value=project)
self.assertSecurityGroup(product, [self.user_id, self.assertSecurityGroup(product, [self.user_id,
'F-SALE*',
'%s_F-CUSTOMER' % project.getReference(), '%s_F-CUSTOMER' % project.getReference(),
'%s_F-PRODAGNT' % project.getReference(), '%s_F-PRODAGNT' % project.getReference(),
'%s_F-PRODMAN' % project.getReference()], False) '%s_F-PRODMAN' % project.getReference()], False)
self.assertRoles(product, self.user_id, ['Owner']) self.assertRoles(product, self.user_id, ['Owner'])
self.assertRoles(product, 'F-SALE*', ['Auditor'])
self.assertRoles(product, '%s_F-PRODMAN' % project.getReference(), ['Assignor']) self.assertRoles(product, '%s_F-PRODMAN' % project.getReference(), ['Assignor'])
self.assertRoles(product, '%s_F-PRODAGNT' % project.getReference(), ['Assignee']) self.assertRoles(product, '%s_F-PRODAGNT' % project.getReference(), ['Assignee'])
self.assertRoles(product, '%s_F-CUSTOMER' % project.getReference(), ['Auditor']) self.assertRoles(product, '%s_F-CUSTOMER' % project.getReference(), ['Auditor'])
......
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