Commit 4e4187d0 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_erp5: Don't rely on Owner Role

    This allows the project owner leave the project if he would like too
parent fc56880e
...@@ -7,10 +7,9 @@ ...@@ -7,10 +7,9 @@
</role> </role>
<role id='Assignee'> <role id='Assignee'>
<property id='title'>Person Owner</property> <property id='title'>Person Owner</property>
<property id='description'>XXXX Review this later</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<property id='base_category_script'>ERP5Type_acquireSecurityFromOwner</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_decision</multi_property>
</role> </role>
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Person Shadow</property> <property id='title'>Person Shadow</property>
......
...@@ -681,6 +681,21 @@ class TestProjectModule(TestSlapOSGroupRoleSecurityMixin): ...@@ -681,6 +681,21 @@ class TestProjectModule(TestSlapOSGroupRoleSecurityMixin):
class TestProject(TestSlapOSGroupRoleSecurityMixin): class TestProject(TestSlapOSGroupRoleSecurityMixin):
def test_with_user(self):
person = self.makePerson(user=1)
project = self.portal.project_module.newContent(
portal_type='Project',
destination_decision_value=person)
project.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(project,
['G-COMPANY', self.user_id, person.getUserId(), project.getReference(), 'R-SHADOW-PERSON'], False)
self.assertRoles(project, 'G-COMPANY', ['Assignor'])
self.assertRoles(project, project.getReference(), ['Assignee'])
self.assertRoles(project, 'R-SHADOW-PERSON', ['Auditor'])
self.assertRoles(project, self.user_id, ['Owner'])
self.assertRoles(project, person.getUserId(), ['Assignee'])
def test(self): def test(self):
project = self.portal.project_module.newContent( project = self.portal.project_module.newContent(
portal_type='Project') portal_type='Project')
...@@ -690,7 +705,8 @@ class TestProject(TestSlapOSGroupRoleSecurityMixin): ...@@ -690,7 +705,8 @@ class TestProject(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(project, 'G-COMPANY', ['Assignor']) self.assertRoles(project, 'G-COMPANY', ['Assignor'])
self.assertRoles(project, project.getReference(), ['Assignee']) self.assertRoles(project, project.getReference(), ['Assignee'])
self.assertRoles(project, 'R-SHADOW-PERSON', ['Auditor']) self.assertRoles(project, 'R-SHADOW-PERSON', ['Auditor'])
self.assertRoles(project, self.user_id, ['Owner', 'Assignee']) self.assertRoles(project, self.user_id, ['Owner'])
class TestPDF(TestSlapOSGroupRoleSecurityMixin): class TestPDF(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
<value> <value>
<tuple> <tuple>
<string>_setReference.*</string> <string>_setReference.*</string>
<string>_setDestinationDecision.*</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
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