Commit 35e7326f authored by Romain Courteaud's avatar Romain Courteaud

slapos_erp5: fixup ticket/event local roles

Sale must have some access on module
parent bed28fa7
......@@ -8,6 +8,10 @@
<item>Auditor</item>
<item>Author</item>
</role>
<role id='F-SALE*'>
<item>Auditor</item>
<item>Author</item>
</role>
</local_roles>
<local_role_group_ids>
<local_role_group_id id='function'>
......@@ -15,6 +19,8 @@
<principal id='F-CUSTOMER'>Author</principal>
<principal id='F-PRODUCTION*'>Auditor</principal>
<principal id='F-PRODUCTION*'>Author</principal>
<principal id='F-SALE*'>Auditor</principal>
<principal id='F-SALE*'>Author</principal>
</local_role_group_id>
</local_role_group_ids>
</local_roles_item>
\ No newline at end of file
......@@ -3,14 +3,14 @@
<role id='F-CUSTOMER'>
<item>Auditor</item>
</role>
<role id='F-PRODUCTION*'>
<role id='F-SALE*'>
<item>Auditor</item>
</role>
</local_roles>
<local_role_group_ids>
<local_role_group_id id='function'>
<principal id='F-CUSTOMER'>Auditor</principal>
<principal id='F-PRODUCTION*'>Auditor</principal>
<principal id='F-SALE*'>Auditor</principal>
</local_role_group_id>
</local_role_group_ids>
</local_roles_item>
\ No newline at end of file
......@@ -8,6 +8,10 @@
<item>Auditor</item>
<item>Author</item>
</role>
<role id='F-SALE*'>
<item>Auditor</item>
<item>Author</item>
</role>
</local_roles>
<local_role_group_ids>
<local_role_group_id id='function'>
......@@ -15,6 +19,8 @@
<principal id='F-CUSTOMER'>Author</principal>
<principal id='F-PRODUCTION*'>Auditor</principal>
<principal id='F-PRODUCTION*'>Author</principal>
<principal id='F-SALE*'>Auditor</principal>
<principal id='F-SALE*'>Author</principal>
</local_role_group_id>
</local_role_group_ids>
</local_roles_item>
\ No newline at end of file
......@@ -11,4 +11,10 @@
<multi_property id='category'>function/production*</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
<role id='Auditor; Author'>
<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>
\ No newline at end of file
<type_roles>
<role id='Auditor'>
<property id='title'>Production</property>
<property id='title'>Project Customer</property>
<multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>function/production*</multi_property>
<multi_property id='category'>function/customer</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Project Customer</property>
<property id='title'>Sale</property>
<multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>function/customer</multi_property>
<multi_property id='category'>function/sale*</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
</type_roles>
\ No newline at end of file
......@@ -11,4 +11,10 @@
<multi_property id='category'>function/customer</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
<role id='Auditor; Author'>
<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>
\ No newline at end of file
......@@ -602,8 +602,9 @@ class TestEventModule(TestSlapOSGroupRoleSecurityMixin):
def test(self):
module = self.portal.event_module
self.assertSecurityGroup(module,
['F-PRODUCTION*', 'F-CUSTOMER', module.Base_getOwnerId()], True)
['F-PRODUCTION*', 'F-SALE*', 'F-CUSTOMER', module.Base_getOwnerId()], True)
self.assertRoles(module, 'F-PRODUCTION*', ['Auditor', 'Author'])
self.assertRoles(module, 'F-SALE*', ['Auditor', 'Author'])
self.assertRoles(module, 'F-CUSTOMER', ['Auditor', 'Author'])
self.assertRoles(module, module.Base_getOwnerId(), ['Owner'])
......@@ -1011,8 +1012,9 @@ class TestSupportRequestModule(TestSlapOSGroupRoleSecurityMixin):
def test_SupportRequestModule(self):
module = self.portal.support_request_module
self.assertSecurityGroup(module,
['F-PRODUCTION*', 'F-CUSTOMER', module.Base_getOwnerId()], True)
['F-PRODUCTION*', 'F-SALE*', 'F-CUSTOMER', module.Base_getOwnerId()], True)
self.assertRoles(module, 'F-PRODUCTION*', ['Auditor', 'Author'])
self.assertRoles(module, 'F-SALE*', ['Auditor', 'Author'])
self.assertRoles(module, 'F-CUSTOMER', ['Auditor', 'Author'])
self.assertRoles(module, module.Base_getOwnerId(), ['Owner'])
......@@ -1073,11 +1075,11 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
class TestRegularisationRequestModule(TestSlapOSGroupRoleSecurityMixin):
def test(self):
def test_RegularisationRequestModule(self):
module = self.portal.regularisation_request_module
self.assertSecurityGroup(module,
['F-PRODUCTION*', 'F-CUSTOMER', module.Base_getOwnerId()], True)
self.assertRoles(module, 'F-PRODUCTION*', ['Auditor'])
['F-SALE*', 'F-CUSTOMER', module.Base_getOwnerId()], True)
self.assertRoles(module, 'F-SALE*', ['Auditor'])
self.assertRoles(module, 'F-CUSTOMER', ['Auditor'])
self.assertRoles(module, module.Base_getOwnerId(), ['Owner'])
......@@ -1109,38 +1111,6 @@ class TestRegularisationRequest(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(support_request, 'F-SALEMAN', ['Assignor'])
self.assertRoles(support_request, 'F-SALEAGT', ['Assignee'])
def test_RegularisationRequest_SourceProject(self):
project = self.addProject()
support_request = self.portal.getDefaultModuleValue(self.ticket_portal_type).newContent(
portal_type=self.ticket_portal_type)
support_request.edit(
source_project_value=project)
self.assertSecurityGroup(support_request, [self.user_id,
'%s_F-PRODAGNT' % project.getReference(),
'%s_F-PRODMAN' % project.getReference(),
'F-SALEAGT', 'F-SALEMAN'], False)
self.assertRoles(support_request, self.user_id, ['Owner'])
self.assertRoles(support_request, '%s_F-PRODMAN' % project.getReference(), ['Assignor'])
self.assertRoles(support_request, '%s_F-PRODAGNT' % project.getReference(), ['Assignee'])
self.assertRoles(support_request, 'F-SALEMAN', ['Assignor'])
self.assertRoles(support_request, 'F-SALEAGT', ['Assignee'])
def test_RegularisationRequest_DestinationProject(self):
project = self.addProject()
support_request = self.portal.getDefaultModuleValue(self.ticket_portal_type).newContent(
portal_type=self.ticket_portal_type)
support_request.edit(
destination_project_value=project)
self.assertSecurityGroup(support_request, [self.user_id,
'%s_F-PRODAGNT' % project.getReference(),
'%s_F-PRODMAN' % project.getReference(),
'F-SALEAGT', 'F-SALEMAN'], False)
self.assertRoles(support_request, self.user_id, ['Owner'])
self.assertRoles(support_request, '%s_F-PRODMAN' % project.getReference(), ['Assignor'])
self.assertRoles(support_request, '%s_F-PRODAGNT' % project.getReference(), ['Assignee'])
self.assertRoles(support_request, 'F-SALEMAN', ['Assignor'])
self.assertRoles(support_request, 'F-SALEAGT', ['Assignee'])
class TestSystemEventModule(TestSlapOSGroupRoleSecurityMixin):
def test_SystemEventModule(self):
......
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