Commit fafa89e6 authored by Romain Courteaud's avatar Romain Courteaud

WIP: invitation token

slapos_erp5: production users can create invitation token

slapos_erp5: do not allow creating Contract Invitation Token anymore

slapos_erp5: invitation token roles

slapos_erp5: trigger invitation token local role generation

slapos_erp5: is an Invitation Token a ticket?

slapos_erp5: test invitation token roles

slapos_erp5: roles for Assignment Request
parent 19903d3e
<local_roles_item>
<local_roles>
<role id='F-PRODUCTION*'>
<item>Auditor</item>
</role>
</local_roles>
<local_role_group_ids>
<local_role_group_id id='function'>
<principal id='F-PRODUCTION*'>Auditor</principal>
</local_role_group_id>
</local_role_group_ids>
</local_roles_item>
\ No newline at end of file
<local_roles_item> <local_roles_item>
<local_roles> <local_roles>
<role id='F-PRODUCTION*'>
<item>Auditor</item>
<item>Author</item>
</role>
</local_roles> </local_roles>
<local_role_group_ids>
<local_role_group_id id='function'>
<principal id='F-PRODUCTION*'>Auditor</principal>
<principal id='F-PRODUCTION*'>Author</principal>
</local_role_group_id>
</local_role_group_ids>
</local_roles_item> </local_roles_item>
\ No newline at end of file
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
<item>Cloud Contract Line</item> <item>Cloud Contract Line</item>
</portal_type> </portal_type>
<portal_type id="Invitation Token Module"> <portal_type id="Invitation Token Module">
<item>Contract Invitation Token</item>
<item>Invitation Token</item> <item>Invitation Token</item>
</portal_type> </portal_type>
<portal_type id="Organisation"> <portal_type id="Organisation">
......
<type_roles>
<role id='Auditor'>
<property id='title'>Production</property>
<multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>function/production*</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
</type_roles>
\ No newline at end of file
<type_roles>
</type_roles>
\ No newline at end of file
<type_roles> <type_roles>
<role id='Auditor; Author'>
<property id='title'>Production</property>
<multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>function/production*</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
</type_roles> </type_roles>
\ No newline at end of file
<type_roles>
<role id='Assignee'>
<property id='title'>Destination Project Production Agent</property>
<property id='description'>XXX add local role group</property>
<property id='condition'>python: context.getDestinationProject('', portal_type='Project') != ""</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='categories'>local_role_group/project</multi_property>
<multi_property id='category'>function/production/agent</multi_property>
<multi_property id='base_category'>destination_project</multi_property>
</role>
<role id='Assignor'>
<property id='title'>Destination Project Production Manager</property>
<property id='description'>XXX add local role group</property>
<property id='condition'>python: context.getDestinationProject('', portal_type='Project') != ""</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='categories'>local_role_group/project</multi_property>
<multi_property id='category'>function/production/manager</multi_property>
<multi_property id='base_category'>destination_project</multi_property>
</role>
</type_roles>
\ No newline at end of file
...@@ -42,9 +42,15 @@ ...@@ -42,9 +42,15 @@
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Base Type</string> </value> <value> <string>Base Type</string> </value>
</item> </item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>type_class</string> </key> <key> <string>type_class</string> </key>
<value> <string>XMLObject</string> </value> <value> <string>Ticket</string> </value>
</item> </item>
<item> <item>
<key> <string>type_interface</string> </key> <key> <string>type_interface</string> </key>
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
</chain> </chain>
<chain> <chain>
<type>Invitation Token</type> <type>Invitation Token</type>
<workflow>edit_workflow, validation_workflow</workflow> <workflow>edit_workflow, local_permission_slapos_interaction_workflow, validation_workflow</workflow>
</chain> </chain>
<chain> <chain>
<type>Mail Message</type> <type>Mail Message</type>
......
...@@ -1015,6 +1015,15 @@ class TestSoftwareProduct(TestSlapOSGroupRoleSecurityMixin): ...@@ -1015,6 +1015,15 @@ class TestSoftwareProduct(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(product, '%s_F-CUSTOMER' % project.getReference(), ['Auditor']) self.assertRoles(product, '%s_F-CUSTOMER' % project.getReference(), ['Auditor'])
class TestInvitationTokenModule(TestSlapOSGroupRoleSecurityMixin):
def test_InvitationTokenModule(self):
module = self.portal.invitation_token_module
self.assertSecurityGroup(module,
['F-PRODUCTION*', module.Base_getOwnerId()], False)
self.assertRoles(module, 'F-PRODUCTION*', ['Auditor', 'Author'])
self.assertRoles(module, module.Base_getOwnerId(), ['Owner'])
class TestSupportRequestModule(TestSlapOSGroupRoleSecurityMixin): class TestSupportRequestModule(TestSlapOSGroupRoleSecurityMixin):
def test_SupportRequestModule(self): def test_SupportRequestModule(self):
module = self.portal.support_request_module module = self.portal.support_request_module
...@@ -1026,6 +1035,30 @@ class TestSupportRequestModule(TestSlapOSGroupRoleSecurityMixin): ...@@ -1026,6 +1035,30 @@ class TestSupportRequestModule(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(module, module.Base_getOwnerId(), ['Owner']) self.assertRoles(module, module.Base_getOwnerId(), ['Owner'])
class TestInvitationToken(TestSlapOSGroupRoleSecurityMixin):
ticket_portal_type = 'Invitation Token'
def test_InvitationToken_default(self):
support_request = self.portal.getDefaultModuleValue(self.ticket_portal_type).newContent(
portal_type=self.ticket_portal_type)
self.assertSecurityGroup(support_request,
[self.user_id], False)
self.assertRoles(support_request, self.user_id, ['Owner'])
def test_InvitationToken_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()], 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'])
class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin): class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
ticket_portal_type = 'Support Request' ticket_portal_type = 'Support Request'
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
<string>Support Request</string> <string>Support Request</string>
<string>Upgrade Decision</string> <string>Upgrade Decision</string>
<string>Regularisation Request</string> <string>Regularisation Request</string>
<string>Invitation Token</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -14,6 +14,7 @@ account_module/refundable_vat ...@@ -14,6 +14,7 @@ account_module/refundable_vat
account_module/sales account_module/sales
accounting_module accounting_module
allocation_supply_module allocation_supply_module
assignment_request_module
business_process_module business_process_module
business_process_module/slapos_sale_subscription_business_process business_process_module/slapos_sale_subscription_business_process
cloud_contract_module cloud_contract_module
......
Contract Invitation Token | Cloud Contract Line Contract Invitation Token | Cloud Contract Line
Invitation Token Module | Contract Invitation Token
Invitation Token Module | Invitation Token Invitation Token Module | Invitation Token
Organisation | Geographical Area Organisation | Geographical Area
Organisation | Geographical Location Organisation | Geographical Location
\ No newline at end of file
...@@ -8,6 +8,8 @@ Acknowledgement ...@@ -8,6 +8,8 @@ Acknowledgement
Allocation Supply Allocation Supply
Allocation Supply Module Allocation Supply Module
Assignment Assignment
Assignment Request
Assignment Request Module
Balance Transaction Balance Transaction
Bank Account Bank Account
Business Process Business Process
...@@ -45,6 +47,7 @@ Instance Tree ...@@ -45,6 +47,7 @@ Instance Tree
Instance Tree Module Instance Tree Module
Integration Site Integration Site
Integration Tool Integration Tool
Invitation Token
Invitation Token Module Invitation Token Module
Letter Letter
Mail Message Mail Message
......
...@@ -21,6 +21,7 @@ Inventory Cell | -immobilisation_movement_interaction_workflow ...@@ -21,6 +21,7 @@ Inventory Cell | -immobilisation_movement_interaction_workflow
Inventory Line | -immobilisation_movement_interaction_workflow Inventory Line | -immobilisation_movement_interaction_workflow
Inventory | -immobilisation_movement_interaction_workflow Inventory | -immobilisation_movement_interaction_workflow
Invitation Token | edit_workflow Invitation Token | edit_workflow
Invitation Token | local_permission_slapos_interaction_workflow
Invitation Token | validation_workflow Invitation Token | validation_workflow
Mail Message | local_permission_slapos_interaction_workflow Mail Message | local_permission_slapos_interaction_workflow
Open Sale Order | local_permission_slapos_interaction_workflow Open Sale Order | local_permission_slapos_interaction_workflow
......
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