Commit 8f40dd92 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_erp5: Allow user to see events from shared via Project/Organisation

   Since an Support Request is updated by moving an Item to a project/organisation, its related Events should have their security updated too.
parent 10739508
...@@ -21,4 +21,22 @@ ...@@ -21,4 +21,22 @@
<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'>Organisation Member (Computer)</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateComputerDestinationSection</property>
<multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='base_category'>destination_section</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Organisation Member (HS)</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateDestination</property>
<multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='base_category'>destination</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Project Member</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateDestinationProject</property>
<multi_property id='categories'>local_role_group/project</multi_property>
<multi_property id='base_category'>destination_project</multi_property>
</role>
</type_roles> </type_roles>
\ No newline at end of file
...@@ -2,18 +2,18 @@ ...@@ -2,18 +2,18 @@
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Customer</property> <property id='title'>Customer</property>
<property id='description'>Monovalued role</property> <property id='description'>Monovalued role</property>
<property id='condition'>python: here.getSourceValue(portal_type='Person') is not None</property> <property id='condition'>python: here.getDestinationValue(portal_type='Person') is not None</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='categories'>local_role_group/user</multi_property> <multi_property id='categories'>local_role_group/user</multi_property>
<multi_property id='base_category'>source</multi_property> <multi_property id='base_category'>destination</multi_property>
</role> </role>
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Customer Destination</property> <property id='title'>Customer</property>
<property id='description'>Monovalued role</property> <property id='description'>Monovalued role</property>
<property id='condition'>python: here.getDestinationValue(portal_type='Person') is not None</property> <property id='condition'>python: here.getSourceValue(portal_type='Person') is not None</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='categories'>local_role_group/user</multi_property> <multi_property id='categories'>local_role_group/user</multi_property>
<multi_property id='base_category'>destination</multi_property> <multi_property id='base_category'>source</multi_property>
</role> </role>
<role id='Assignor'> <role id='Assignor'>
<property id='title'>Group company</property> <property id='title'>Group company</property>
...@@ -21,4 +21,22 @@ ...@@ -21,4 +21,22 @@
<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'>Organisation Member (Computer)</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateComputerDestinationSection</property>
<multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='base_category'>destination_section</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Organisation Member (HS)</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateDestination</property>
<multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='base_category'>destination</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Project Member</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateDestinationProject</property>
<multi_property id='categories'>local_role_group/project</multi_property>
<multi_property id='base_category'>destination_project</multi_property>
</role>
</type_roles> </type_roles>
\ No newline at end of file
...@@ -2,18 +2,18 @@ ...@@ -2,18 +2,18 @@
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Customer</property> <property id='title'>Customer</property>
<property id='description'>Monovalued role</property> <property id='description'>Monovalued role</property>
<property id='condition'>python: here.getSourceValue(portal_type='Person') is not None</property> <property id='condition'>python: here.getDestinationValue(portal_type='Person') is not None</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='categories'>local_role_group/user</multi_property> <multi_property id='categories'>local_role_group/user</multi_property>
<multi_property id='base_category'>source</multi_property> <multi_property id='base_category'>destination</multi_property>
</role> </role>
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Customer Destination</property> <property id='title'>Customer</property>
<property id='description'>Monovalued role</property> <property id='description'>Monovalued role</property>
<property id='condition'>python: here.getDestinationValue(portal_type='Person') is not None</property> <property id='condition'>python: here.getSourceValue(portal_type='Person') is not None</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='categories'>local_role_group/user</multi_property> <multi_property id='categories'>local_role_group/user</multi_property>
<multi_property id='base_category'>destination</multi_property> <multi_property id='base_category'>source</multi_property>
</role> </role>
<role id='Assignor'> <role id='Assignor'>
<property id='title'>Group company</property> <property id='title'>Group company</property>
...@@ -21,4 +21,22 @@ ...@@ -21,4 +21,22 @@
<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'>Organisation Member (Computer)</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateComputerDestinationSection</property>
<multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='base_category'>destination_section</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Organisation Member (HS)</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateDestination</property>
<multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='base_category'>destination</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Project Member</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateDestinationProject</property>
<multi_property id='categories'>local_role_group/project</multi_property>
<multi_property id='base_category'>destination_project</multi_property>
</role>
</type_roles> </type_roles>
\ No newline at end of file
...@@ -21,4 +21,22 @@ ...@@ -21,4 +21,22 @@
<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'>Organisation Member (Computer)</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateComputerDestinationSection</property>
<multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='base_category'>destination_section</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Organisation Member (HS)</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateDestination</property>
<multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='base_category'>destination</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Project Member</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateDestinationProject</property>
<multi_property id='categories'>local_role_group/project</multi_property>
<multi_property id='base_category'>destination_project</multi_property>
</role>
</type_roles> </type_roles>
\ No newline at end of file
...@@ -2,18 +2,18 @@ ...@@ -2,18 +2,18 @@
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Customer</property> <property id='title'>Customer</property>
<property id='description'>Monovalued role</property> <property id='description'>Monovalued role</property>
<property id='condition'>python: here.getSourceValue(portal_type='Person') is not None</property> <property id='condition'>python: here.getDestinationValue(portal_type='Person') is not None</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='categories'>local_role_group/user</multi_property> <multi_property id='categories'>local_role_group/user</multi_property>
<multi_property id='base_category'>source</multi_property> <multi_property id='base_category'>destination</multi_property>
</role> </role>
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Customer Destination</property> <property id='title'>Customer</property>
<property id='description'>Monovalued role</property> <property id='description'>Monovalued role</property>
<property id='condition'>python: here.getDestinationValue(portal_type='Person') is not None</property> <property id='condition'>python: here.getSourceValue(portal_type='Person') is not None</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='categories'>local_role_group/user</multi_property> <multi_property id='categories'>local_role_group/user</multi_property>
<multi_property id='base_category'>destination</multi_property> <multi_property id='base_category'>source</multi_property>
</role> </role>
<role id='Assignor'> <role id='Assignor'>
<property id='title'>Group company</property> <property id='title'>Group company</property>
...@@ -21,4 +21,22 @@ ...@@ -21,4 +21,22 @@
<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'>Organisation Member (Computer)</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateComputerDestinationSection</property>
<multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='base_category'>destination_section</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Organisation Member (HS)</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateDestination</property>
<multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='base_category'>destination</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Project Member</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateDestinationProject</property>
<multi_property id='categories'>local_role_group/project</multi_property>
<multi_property id='base_category'>destination_project</multi_property>
</role>
</type_roles> </type_roles>
\ No newline at end of file
...@@ -2,18 +2,18 @@ ...@@ -2,18 +2,18 @@
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Customer</property> <property id='title'>Customer</property>
<property id='description'>Monovalued role</property> <property id='description'>Monovalued role</property>
<property id='condition'>python: here.getSourceValue(portal_type='Person') is not None</property> <property id='condition'>python: here.getDestinationValue(portal_type='Person') is not None</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='categories'>local_role_group/user</multi_property> <multi_property id='categories'>local_role_group/user</multi_property>
<multi_property id='base_category'>source</multi_property> <multi_property id='base_category'>destination</multi_property>
</role> </role>
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Customer Destination</property> <property id='title'>Customer</property>
<property id='description'>Monovalued role</property> <property id='description'>Monovalued role</property>
<property id='condition'>python: here.getDestinationValue(portal_type='Person') is not None</property> <property id='condition'>python: here.getSourceValue(portal_type='Person') is not None</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='categories'>local_role_group/user</multi_property> <multi_property id='categories'>local_role_group/user</multi_property>
<multi_property id='base_category'>destination</multi_property> <multi_property id='base_category'>source</multi_property>
</role> </role>
<role id='Assignor'> <role id='Assignor'>
<property id='title'>Group company</property> <property id='title'>Group company</property>
...@@ -21,4 +21,22 @@ ...@@ -21,4 +21,22 @@
<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'>Organisation Member (Computer)</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateComputerDestinationSection</property>
<multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='base_category'>destination_section</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Organisation Member (HS)</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateDestination</property>
<multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='base_category'>destination</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Project Member</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateDestinationProject</property>
<multi_property id='categories'>local_role_group/project</multi_property>
<multi_property id='base_category'>destination_project</multi_property>
</role>
</type_roles> </type_roles>
\ No newline at end of file
...@@ -2,18 +2,18 @@ ...@@ -2,18 +2,18 @@
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Customer</property> <property id='title'>Customer</property>
<property id='description'>Monovalued role</property> <property id='description'>Monovalued role</property>
<property id='condition'>python: here.getSourceValue(portal_type='Person') is not None</property> <property id='condition'>python: here.getDestinationValue(portal_type='Person') is not None</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='categories'>local_role_group/user</multi_property> <multi_property id='categories'>local_role_group/user</multi_property>
<multi_property id='base_category'>source</multi_property> <multi_property id='base_category'>destination</multi_property>
</role> </role>
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Customer Destination</property> <property id='title'>Customer</property>
<property id='description'>Monovalued role</property> <property id='description'>Monovalued role</property>
<property id='condition'>python: here.getDestinationValue(portal_type='Person') is not None</property> <property id='condition'>python: here.getSourceValue(portal_type='Person') is not None</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='categories'>local_role_group/user</multi_property> <multi_property id='categories'>local_role_group/user</multi_property>
<multi_property id='base_category'>destination</multi_property> <multi_property id='base_category'>source</multi_property>
</role> </role>
<role id='Assignor'> <role id='Assignor'>
<property id='title'>Group company</property> <property id='title'>Group company</property>
...@@ -21,4 +21,22 @@ ...@@ -21,4 +21,22 @@
<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'>Organisation Member (Computer)</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateComputerDestinationSection</property>
<multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='base_category'>destination_section</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Organisation Member (HS)</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateDestination</property>
<multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='base_category'>destination</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Project Member</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateDestinationProject</property>
<multi_property id='categories'>local_role_group/project</multi_property>
<multi_property id='base_category'>destination_project</multi_property>
</role>
</type_roles> </type_roles>
\ No newline at end of file
...@@ -21,4 +21,22 @@ ...@@ -21,4 +21,22 @@
<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'>Organisation Member (Computer)</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateComputerDestinationSection</property>
<multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='base_category'>destination_section</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Organisation Member (HS)</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateDestination</property>
<multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='base_category'>destination</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Project Member</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateDestinationProject</property>
<multi_property id='categories'>local_role_group/project</multi_property>
<multi_property id='base_category'>destination_project</multi_property>
</role>
</type_roles> </type_roles>
\ No newline at end of file
...@@ -2,18 +2,18 @@ ...@@ -2,18 +2,18 @@
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Customer</property> <property id='title'>Customer</property>
<property id='description'>Monovalued role</property> <property id='description'>Monovalued role</property>
<property id='condition'>python: here.getSourceValue(portal_type='Person') is not None</property> <property id='condition'>python: here.getDestinationValue(portal_type='Person') is not None</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='categories'>local_role_group/user</multi_property> <multi_property id='categories'>local_role_group/user</multi_property>
<multi_property id='base_category'>source</multi_property> <multi_property id='base_category'>destination</multi_property>
</role> </role>
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Customer Destination</property> <property id='title'>Customer</property>
<property id='description'>Monovalued role</property> <property id='description'>Monovalued role</property>
<property id='condition'>python: here.getDestinationValue(portal_type='Person') is not None</property> <property id='condition'>python: here.getSourceValue(portal_type='Person') is not None</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='categories'>local_role_group/user</multi_property> <multi_property id='categories'>local_role_group/user</multi_property>
<multi_property id='base_category'>destination</multi_property> <multi_property id='base_category'>source</multi_property>
</role> </role>
<role id='Assignor'> <role id='Assignor'>
<property id='title'>Group company</property> <property id='title'>Group company</property>
...@@ -21,4 +21,22 @@ ...@@ -21,4 +21,22 @@
<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'>Organisation Member (Computer)</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateComputerDestinationSection</property>
<multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='base_category'>destination_section</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Organisation Member (HS)</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateDestination</property>
<multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='base_category'>destination</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Project Member</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateDestinationProject</property>
<multi_property id='categories'>local_role_group/project</multi_property>
<multi_property id='base_category'>destination_project</multi_property>
</role>
</type_roles> </type_roles>
\ No newline at end of file
...@@ -2,18 +2,18 @@ ...@@ -2,18 +2,18 @@
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Customer</property> <property id='title'>Customer</property>
<property id='description'>Monovalued role</property> <property id='description'>Monovalued role</property>
<property id='condition'>python: here.getSourceValue(portal_type='Person') is not None</property> <property id='condition'>python: here.getDestinationValue(portal_type='Person') is not None</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='categories'>local_role_group/user</multi_property> <multi_property id='categories'>local_role_group/user</multi_property>
<multi_property id='base_category'>source</multi_property> <multi_property id='base_category'>destination</multi_property>
</role> </role>
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Customer (Destination)</property> <property id='title'>Customer</property>
<property id='description'>Monovalued role</property> <property id='description'>Monovalued role</property>
<property id='condition'>python: here.getDestinationValue(portal_type='Person') is not None</property> <property id='condition'>python: here.getSourceValue(portal_type='Person') is not None</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='categories'>local_role_group/user</multi_property> <multi_property id='categories'>local_role_group/user</multi_property>
<multi_property id='base_category'>destination</multi_property> <multi_property id='base_category'>source</multi_property>
</role> </role>
<role id='Assignor'> <role id='Assignor'>
<property id='title'>Group company</property> <property id='title'>Group company</property>
...@@ -22,10 +22,21 @@ ...@@ -22,10 +22,21 @@
<multi_property id='base_category'>group</multi_property> <multi_property id='base_category'>group</multi_property>
</role> </role>
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Member can see template</property> <property id='title'>Organisation Member (Computer)</property>
<property id='condition'>python: here.getRelativeUrl() == here.getPortalObject().portal_preferences.getPreferredWebMessageTemplate()</property> <property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateComputerDestinationSection</property>
<multi_property id='categories'>local_role_group/user</multi_property> <multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='category'>role/member</multi_property> <multi_property id='base_category'>destination_section</multi_property>
<multi_property id='base_category'>role</multi_property> </role>
<role id='Auditor'>
<property id='title'>Organisation Member (HS)</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateDestination</property>
<multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='base_category'>destination</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Project Member</property>
<property id='base_category_script'>Event_getSecurityCategoryFromMovementFollowUpAggregateDestinationProject</property>
<multi_property id='categories'>local_role_group/project</multi_property>
<multi_property id='base_category'>destination_project</multi_property>
</role> </role>
</type_roles> </type_roles>
\ No newline at end of file
from zExceptions import Unauthorized
if REQUEST is not None:
raise Unauthorized
context.updateLocalRolesOnSecurityGroups()
if context.getPortalType() in ['Support Request', 'Upgrade Decision']:
portal = context.getPortalObject()
if activate_kw is None:
activate_kw = {}
portal.portal_catalog.searchAndActivate(
portal_type=portal.getPortalEventTypeList(),
follow_up__uid=context.getUid(),
method_id="updateLocalRolesOnSecurityGroups",
activate_kw=activate_kw
)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>activate_kw=None, REQUEST=None, **kw</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_updateSlapOSLocalRolesOnSecurityGroups</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
This script returns a list of dictionaries which represent
the security groups which a person is member of. It extracts
the categories from the current content. It is useful in the
following cases:
- calculate a security group based on a given
category of the current object (ex. group). This
is used for example in ERP5 DMS to calculate
document security.
- assign local roles to a document based on
the person which the object related to through
a given base category (ex. destination). This
is used for example in ERP5 Project to calculate
Task / Task Report security.
The parameters are
base_category_list -- list of category values we need to retrieve
user_name -- string obtained from getSecurityManager().getUser().getId()
object -- object which we want to assign roles to
portal_type -- portal type of object
NOTE: for now, this script requires proxy manager
"""
category_list = []
if obj is None:
return []
# Object here is a event
ticket = obj.getFollowUpValue()
if ticket is None:
return []
aggregate_value = ticket.getAggregateValue()
if aggregate_value is None:
return []
# Only proceed if aggregate is a Computer
if aggregate_value.getPortalType() != "Computer":
return []
# Object on this case can be Hosting Subscription, Computer, or Computer Network
organisation = aggregate_value.Item_getCurrentOwnerValue()
if organisation is not None and \
organisation.getPortalType() == "Organisation":
category_list.append({'destination_section': [organisation.getRelativeUrl()]})
return category_list
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>base_category_list, user_name, obj, portal_type</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Event_getSecurityCategoryFromMovementFollowUpAggregateComputerDestinationSection</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
This script returns a list of dictionaries which represent
the security groups which a person is member of. It extracts
the categories from the current content. It is useful in the
following cases:
- calculate a security group based on a given
category of the current object (ex. group). This
is used for example in ERP5 DMS to calculate
document security.
- assign local roles to a document based on
the person which the object related to through
a given base category (ex. destination). This
is used for example in ERP5 Project to calculate
Task / Task Report security.
The parameters are
base_category_list -- list of category values we need to retrieve
user_name -- string obtained from getSecurityManager().getUser().getId()
object -- object which we want to assign roles to
portal_type -- portal type of object
NOTE: for now, this script requires proxy manager
"""
category_list = []
if obj is None:
return []
# Object here is a event
ticket = obj.getFollowUpValue()
if ticket is None:
return []
aggregate_value = ticket.getAggregateValue()
if aggregate_value is None:
return []
# Limit the scope arround Hosting subscription otherwise we
# Leak security on the Computers placed on the same site.
if aggregate_value.getPortalType() != "Hosting Subscription":
return []
organisation = aggregate_value.Item_getCurrentSiteValue()
if organisation is not None and \
organisation.getPortalType() == "Organisation":
category_list.append({'destination': [organisation.getRelativeUrl()]})
return category_list
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>base_category_list, user_name, obj, portal_type</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Event_getSecurityCategoryFromMovementFollowUpAggregateDestination</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
This script returns a list of dictionaries which represent
the security groups which a person is member of. It extracts
the categories from the current content. It is useful in the
following cases:
- calculate a security group based on a given
category of the current object (ex. group). This
is used for example in ERP5 DMS to calculate
document security.
- assign local roles to a document based on
the person which the object related to through
a given base category (ex. destination). This
is used for example in ERP5 Project to calculate
Task / Task Report security.
The parameters are
base_category_list -- list of category values we need to retrieve
user_name -- string obtained from getSecurityManager().getUser().getId()
object -- object which we want to assign roles to
portal_type -- portal type of object
NOTE: for now, this script requires proxy manager
"""
category_list = []
if obj is None:
return []
# Object here is a event
ticket = obj.getFollowUpValue()
if ticket is None:
return []
aggregate_value = ticket.getAggregateValue()
if aggregate_value is None:
return []
# Object on this case can be Hosting Subscription, Computer, or Computer Network
project = aggregate_value.Item_getCurrentProjectValue()
if project is not None:
category_list.append({'destination_project': [project.getRelativeUrl()]})
return category_list
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>base_category_list, user_name, obj, portal_type</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Event_getSecurityCategoryFromMovementFollowUpAggregateDestinationProject</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -1755,46 +1755,6 @@ class TestEventModule(TestSlapOSGroupRoleSecurityMixin): ...@@ -1755,46 +1755,6 @@ class TestEventModule(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author']) self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author'])
self.assertRoles(module, self.user_id, ['Owner']) self.assertRoles(module, self.user_id, ['Owner'])
class TestFaxMessage(TestSlapOSGroupRoleSecurityMixin):
def test_GroupCompany(self):
product = self.portal.event_module.newContent(
portal_type='Fax Message')
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_SourceCustomer(self):
reference = 'TESTPERSON-%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
product = self.portal.event_module.newContent(
portal_type='Fax Message',
source_value=person,
)
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', person.getUserId(), self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, person.getUserId(), ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner'])
def test_DestinationCustomer(self):
reference = 'TESTPERSON-%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
product = self.portal.event_module.newContent(
portal_type='Fax Message',
destination_value=person,
)
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', person.getUserId(), self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, person.getUserId(), ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner'])
class TestGadget(TestSlapOSGroupRoleSecurityMixin): class TestGadget(TestSlapOSGroupRoleSecurityMixin):
def test_GroupCompany(self): def test_GroupCompany(self):
product = self.portal.portal_gadgets.newContent( product = self.portal.portal_gadgets.newContent(
...@@ -1863,10 +1823,11 @@ class TestKnowledgePadModule(TestSlapOSGroupRoleSecurityMixin): ...@@ -1863,10 +1823,11 @@ class TestKnowledgePadModule(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
self.assertRoles(module, self.user_id, ['Owner']) self.assertRoles(module, self.user_id, ['Owner'])
class TestLetter(TestSlapOSGroupRoleSecurityMixin): class TestMailMessage(TestSlapOSGroupRoleSecurityMixin):
event_portal_type = 'Mail Message'
def test_GroupCompany(self): def test_GroupCompany(self):
product = self.portal.event_module.newContent( product = self.portal.event_module.newContent(
portal_type='Letter') portal_type=self.event_portal_type)
product.updateLocalRolesOnSecurityGroups() product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product, self.assertSecurityGroup(product,
['G-COMPANY', self.user_id], False) ['G-COMPANY', self.user_id], False)
...@@ -1878,7 +1839,7 @@ class TestLetter(TestSlapOSGroupRoleSecurityMixin): ...@@ -1878,7 +1839,7 @@ class TestLetter(TestSlapOSGroupRoleSecurityMixin):
person = self.portal.person_module.newContent(portal_type='Person', person = self.portal.person_module.newContent(portal_type='Person',
reference=reference) reference=reference)
product = self.portal.event_module.newContent( product = self.portal.event_module.newContent(
portal_type='Letter', portal_type=self.event_portal_type,
source_value=person, source_value=person,
) )
product.updateLocalRolesOnSecurityGroups() product.updateLocalRolesOnSecurityGroups()
...@@ -1893,7 +1854,7 @@ class TestLetter(TestSlapOSGroupRoleSecurityMixin): ...@@ -1893,7 +1854,7 @@ class TestLetter(TestSlapOSGroupRoleSecurityMixin):
person = self.portal.person_module.newContent(portal_type='Person', person = self.portal.person_module.newContent(portal_type='Person',
reference=reference) reference=reference)
product = self.portal.event_module.newContent( product = self.portal.event_module.newContent(
portal_type='Letter', portal_type=self.event_portal_type,
destination_value=person, destination_value=person,
) )
product.updateLocalRolesOnSecurityGroups() product.updateLocalRolesOnSecurityGroups()
...@@ -1903,185 +1864,200 @@ class TestLetter(TestSlapOSGroupRoleSecurityMixin): ...@@ -1903,185 +1864,200 @@ class TestLetter(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(product, person.getUserId(), ['Auditor']) self.assertRoles(product, person.getUserId(), ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner']) self.assertRoles(product, self.user_id, ['Owner'])
class TestMailMessage(TestSlapOSGroupRoleSecurityMixin): def test_ProjectMember(self):
def test_GroupCompany(self): person = self.makePerson(user=1)
product = self.portal.event_module.newContent( computer = self.portal.computer_module.newContent(
portal_type='Mail Message') portal_type='Computer',
product.updateLocalRolesOnSecurityGroups() source_administration=person.getRelativeUrl())
self.assertSecurityGroup(product, project = self.portal.project_module.newContent(
['G-COMPANY', self.user_id], False) portal_type='Project')
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, self.user_id, ['Owner'])
def test_SourceCustomer(self): self.tic()
reference = 'TESTPERSON-%s' % self.generateNewId() self.login(person.getUserId())
person = self.portal.person_module.newContent(portal_type='Person', computer.Computer_createMovement(
reference=reference) destination=person.getRelativeUrl(),
product = self.portal.event_module.newContent( destination_project=project.getRelativeUrl())
portal_type='Mail Message', self.login()
source_value=person, self.tic()
support_request = self.portal.support_request_module.newContent(
portal_type='Support Request',
destination_decision_value=person,
aggregate=computer.getRelativeUrl()
) )
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', person.getUserId(), self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, person.getUserId(), ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner'])
def test_DestinationCustomer(self): event = self.portal.event_module.newContent(
reference = 'TESTPERSON-%s' % self.generateNewId() portal_type=self.event_portal_type,
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
product = self.portal.event_module.newContent(
portal_type='Mail Message',
destination_value=person, destination_value=person,
follow_up=support_request.getRelativeUrl()
) )
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', person.getUserId(), self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, person.getUserId(), ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner'])
class TestMeeting(TestSlapOSGroupRoleSecurityMixin): event.updateLocalRolesOnSecurityGroups()
def test_GroupCompany(self): self.assertSecurityGroup(event,
product = self.portal.meeting_module.newContent( ['G-COMPANY', person.getUserId(),
portal_type='Meeting') self.user_id, project.getReference()], False)
product.updateLocalRolesOnSecurityGroups() self.assertRoles(event, 'G-COMPANY', ['Assignor'])
self.assertSecurityGroup(product, self.assertRoles(event, person.getUserId(), ['Auditor'])
['G-COMPANY', self.user_id], False) self.assertRoles(event, project.getReference(), ['Auditor'])
self.assertRoles(product, 'G-COMPANY', ['Assignor']) self.assertRoles(event, self.user_id, ['Owner'])
self.assertRoles(product, self.user_id, ['Owner'])
class TestMeetingModule(TestSlapOSGroupRoleSecurityMixin): def test_ProjectMember_HostingSubscriptionRequest(self):
def test(self):
module = self.portal.meeting_module
self.changeOwnership(module)
self.assertSecurityGroup(module,
['G-COMPANY', self.user_id], True)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
self.assertRoles(module, self.user_id, ['Owner'])
class TestNote(TestSlapOSGroupRoleSecurityMixin): person = self.makePerson(user=1)
def test_GroupCompany(self): hosting_subscription = self.portal.hosting_subscription_module.newContent(
product = self.portal.event_module.newContent( portal_type='Hosting Subscription',
portal_type='Note') destination_section=person.getRelativeUrl())
product.updateLocalRolesOnSecurityGroups() project = self.portal.project_module.newContent(
self.assertSecurityGroup(product, portal_type='Project')
['G-COMPANY', self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, self.user_id, ['Owner'])
def test_SourceCustomer(self): self.tic()
reference = 'TESTPERSON-%s' % self.generateNewId() self.login(person.getUserId())
person = self.portal.person_module.newContent(portal_type='Person', hosting_subscription.HostingSubscription_createMovement(
reference=reference) destination_project=project.getRelativeUrl())
product = self.portal.event_module.newContent( self.login()
portal_type='Note', self.tic()
source_value=person,
support_request = self.portal.support_request_module.newContent(
portal_type='Support Request',
destination_decision_value=person,
aggregate=hosting_subscription.getRelativeUrl()
) )
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', person.getUserId(), self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, person.getUserId(), ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner'])
def test_DestinationCustomer(self): event = self.portal.event_module.newContent(
reference = 'TESTPERSON-%s' % self.generateNewId() portal_type=self.event_portal_type,
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
product = self.portal.event_module.newContent(
portal_type='Note',
destination_value=person, destination_value=person,
follow_up=support_request.getRelativeUrl()
) )
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', person.getUserId(), self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, person.getUserId(), ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner'])
class TestPhoneCall(TestSlapOSGroupRoleSecurityMixin): event.updateLocalRolesOnSecurityGroups()
def test_GroupCompany(self): self.assertSecurityGroup(event,
product = self.portal.event_module.newContent( ['G-COMPANY', person.getUserId(),
portal_type='Phone Call') self.user_id, project.getReference()], False)
product.updateLocalRolesOnSecurityGroups() self.assertRoles(event, 'G-COMPANY', ['Assignor'])
self.assertSecurityGroup(product, self.assertRoles(event, person.getUserId(), ['Auditor'])
['G-COMPANY', self.user_id], False) self.assertRoles(event, project.getReference(), ['Auditor'])
self.assertRoles(product, 'G-COMPANY', ['Assignor']) self.assertRoles(event, self.user_id, ['Owner'])
self.assertRoles(product, self.user_id, ['Owner'])
def test_SourceCustomer(self):
reference = 'TESTPERSON-%s' % self.generateNewId() def test_OrganisationMember(self):
person = self.portal.person_module.newContent(portal_type='Person', person = self.makePerson(user=1)
reference=reference) computer = self.portal.computer_module.newContent(
product = self.portal.event_module.newContent( portal_type='Computer',
portal_type='Phone Call', source_administration=person.getRelativeUrl())
source_value=person, organisation = self.portal.organisation_module.newContent(
portal_type='Organisation',
reference="TESTO-%s" % self.generateNewId())
self.tic()
self.login(person.getUserId())
computer.Computer_createMovement(
destination=person.getRelativeUrl(),
destination_section=organisation.getRelativeUrl())
self.login()
self.tic()
support_request = self.portal.support_request_module.newContent(
portal_type='Support Request',
destination_decision_value=person,
aggregate=computer.getRelativeUrl()
) )
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', person.getUserId(), self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, person.getUserId(), ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner'])
def test_DestinationCustomer(self): event = self.portal.event_module.newContent(
reference = 'TESTPERSON-%s' % self.generateNewId() portal_type=self.event_portal_type,
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
product = self.portal.event_module.newContent(
portal_type='Phone Call',
destination_value=person, destination_value=person,
follow_up=support_request.getRelativeUrl()
) )
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', person.getUserId(), self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, person.getUserId(), ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner'])
class TestVisit(TestSlapOSGroupRoleSecurityMixin): event.updateLocalRolesOnSecurityGroups()
def test_GroupCompany(self): self.assertSecurityGroup(event,
product = self.portal.event_module.newContent( ['G-COMPANY', person.getUserId(),
portal_type='Visit') self.user_id, organisation.getReference()], False)
product.updateLocalRolesOnSecurityGroups() self.assertRoles(event, 'G-COMPANY', ['Assignor'])
self.assertSecurityGroup(product, self.assertRoles(event, person.getUserId(), ['Auditor'])
['G-COMPANY', self.user_id], False) self.assertRoles(event, organisation.getReference(), ['Auditor'])
self.assertRoles(product, 'G-COMPANY', ['Assignor']) self.assertRoles(event, self.user_id, ['Owner'])
self.assertRoles(product, self.user_id, ['Owner'])
def test_SourceCustomer(self): def test_OrganisationMember_HostingSubscription(self):
reference = 'TESTPERSON-%s' % self.generateNewId() person = self.makePerson(user=1)
person = self.portal.person_module.newContent(portal_type='Person', hosting_subscription = self.portal.hosting_subscription_module.newContent(
reference=reference) portal_type='Hosting Subscription',
product = self.portal.event_module.newContent( destination_section=person.getRelativeUrl())
portal_type='Visit', organisation = self.portal.organisation_module.newContent(
source_value=person, portal_type='Organisation',
reference="TESTO-%s" % self.generateNewId())
self.tic()
self.login(person.getUserId())
hosting_subscription.HostingSubscription_createMovement(
destination=organisation.getRelativeUrl())
self.login()
self.tic()
support_request = self.portal.support_request_module.newContent(
portal_type='Support Request',
destination_decision_value=person,
aggregate=hosting_subscription.getRelativeUrl()
) )
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', person.getUserId(), self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, person.getUserId(), ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner'])
def test_DestinationCustomer(self): event = self.portal.event_module.newContent(
reference = 'TESTPERSON-%s' % self.generateNewId() portal_type=self.event_portal_type,
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
product = self.portal.event_module.newContent(
portal_type='Visit',
destination_value=person, destination_value=person,
follow_up=support_request.getRelativeUrl()
) )
event.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(event,
['G-COMPANY', person.getUserId(),
self.user_id, organisation.getReference()], False)
self.assertRoles(event, 'G-COMPANY', ['Assignor'])
self.assertRoles(event, person.getUserId(), ['Auditor'])
self.assertRoles(event, organisation.getReference(), ['Auditor'])
self.assertRoles(event, self.user_id, ['Owner'])
class TestShortMessage(TestMailMessage):
event_portal_type = 'Short Message'
class TestSiteMessage(TestMailMessage):
event_portal_type = 'Site Message'
class TestWebMessage(TestMailMessage):
event_portal_type = 'Web Message'
class TestNote(TestMailMessage):
event_portal_type = 'Note'
class TestPhoneCall(TestMailMessage):
event_portal_type = 'Phone Call'
class TestVisit(TestMailMessage):
event_portal_type = 'Visit'
class TestFaxMessage(TestMailMessage):
event_portal_type = 'Fax Message'
class TestLetter(TestMailMessage):
event_portal_type = 'Letter'
class TestMeeting(TestSlapOSGroupRoleSecurityMixin):
def test_GroupCompany(self):
product = self.portal.meeting_module.newContent(
portal_type='Meeting')
product.updateLocalRolesOnSecurityGroups() product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product, self.assertSecurityGroup(product,
['G-COMPANY', person.getUserId(), self.user_id], False) ['G-COMPANY', self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor']) self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, person.getUserId(), ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner']) self.assertRoles(product, self.user_id, ['Owner'])
class TestMeetingModule(TestSlapOSGroupRoleSecurityMixin):
def test(self):
module = self.portal.meeting_module
self.changeOwnership(module)
self.assertSecurityGroup(module,
['G-COMPANY', self.user_id], True)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
self.assertRoles(module, self.user_id, ['Owner'])
class TestNotificationMessageModule(TestSlapOSGroupRoleSecurityMixin): class TestNotificationMessageModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.notification_message_module module = self.portal.notification_message_module
...@@ -2196,139 +2172,6 @@ class TestSaleOpportunity(TestSlapOSGroupRoleSecurityMixin): ...@@ -2196,139 +2172,6 @@ class TestSaleOpportunity(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'])
class TestShortMessage(TestSlapOSGroupRoleSecurityMixin):
def test_GroupCompany(self):
product = self.portal.event_module.newContent(
portal_type='Short Message')
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_SourceCustomer(self):
reference = 'TESTPERSON-%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
product = self.portal.event_module.newContent(
portal_type='Short Message',
source_value=person,
)
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', person.getUserId(), self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, person.getUserId(), ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner'])
def test_DestinationCustomer(self):
reference = 'TESTPERSON-%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
product = self.portal.event_module.newContent(
portal_type='Short Message',
destination_value=person,
)
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', person.getUserId(), self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, person.getUserId(), ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner'])
class TestSiteMessage(TestSlapOSGroupRoleSecurityMixin):
def test_GroupCompany(self):
product = self.portal.event_module.newContent(
portal_type='Site Message')
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_SourceCustomer(self):
reference = 'TESTPERSON-%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
product = self.portal.event_module.newContent(
portal_type='Site Message',
source_value=person,
)
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', person.getUserId(), self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, person.getUserId(), ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner'])
def test_DestinationCustomer(self):
reference = 'TESTPERSON-%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
product = self.portal.event_module.newContent(
portal_type='Site Message',
destination_value=person,
)
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', person.getUserId(), self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, person.getUserId(), ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner'])
class TestWebMessage(TestSlapOSGroupRoleSecurityMixin):
def test_GroupCompany(self):
product = self.portal.event_module.newContent(
portal_type='Web Message')
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_SourceCustomer(self):
reference = 'TESTPERSON-%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
product = self.portal.event_module.newContent(
portal_type='Web Message',
source_value=person,
)
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', person.getUserId(), self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, person.getUserId(), ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner'])
def test_DestinationCustomer(self):
reference = 'TESTPERSON-%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
product = self.portal.event_module.newContent(
portal_type='Web Message',
destination_value=person,
)
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', person.getUserId(), self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, person.getUserId(), ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner'])
def test_Template(self):
product = self.portal.restrictedTraverse(
self.portal.portal_preferences.getPreferredWebMessageTemplate())
assert product.getPortalType() == 'Web Message'
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', product.Base_getOwnerId(), 'R-MEMBER'], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, product.Base_getOwnerId(), ['Owner'])
self.assertRoles(product, 'R-MEMBER', ['Auditor'])
self.assertPermissionsOfRole(product, 'Auditor',
['Access contents information', 'View'])
class TestSupportRequestModule(TestSlapOSGroupRoleSecurityMixin): class TestSupportRequestModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
module = self.portal.support_request_module module = self.portal.support_request_module
......
...@@ -11,7 +11,8 @@ for object_ in internal_packing_list_line.getAggregateValueList(portal_type=port ...@@ -11,7 +11,8 @@ for object_ in internal_packing_list_line.getAggregateValueList(portal_type=port
portal.portal_catalog.searchAndActivate( portal.portal_catalog.searchAndActivate(
portal_type=["Software Installation", "Support Request","Upgrade Decision"], portal_type=["Software Installation", "Support Request","Upgrade Decision"],
default_or_child_aggregate_uid=object_.getUid(), default_or_child_aggregate_uid=object_.getUid(),
method_id="updateLocalRolesOnSecurityGroups", method_id="Base_updateSlapOSLocalRolesOnSecurityGroups",
method_kw=dict(activate_kw={"after_path_and_method_id": after_tag}),
activate_kw={"after_path_and_method_id": after_tag} activate_kw={"after_path_and_method_id": after_tag}
) )
...@@ -29,6 +30,7 @@ for object_ in internal_packing_list_line.getAggregateValueList(portal_type=port ...@@ -29,6 +30,7 @@ for object_ in internal_packing_list_line.getAggregateValueList(portal_type=port
) )
portal.portal_catalog.searchAndActivate( portal.portal_catalog.searchAndActivate(
query=query, query=query,
method_id="updateLocalRolesOnSecurityGroups", method_id="Base_updateSlapOSLocalRolesOnSecurityGroups",
method_kw=dict(activate_kw={"after_path_and_method_id": after_tag}),
activate_kw={"after_path_and_method_id": after_tag} activate_kw={"after_path_and_method_id": after_tag}
) )
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