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 @@
</role>
<role id='Assignee'>
<property id='title'>Person Owner</property>
<property id='description'>XXXX Review this later</property>
<property id='base_category_script'>ERP5Type_acquireSecurityFromOwner</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</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 id='Auditor'>
<property id='title'>Person Shadow</property>
......
......@@ -681,6 +681,21 @@ class TestProjectModule(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):
project = self.portal.project_module.newContent(
portal_type='Project')
......@@ -690,7 +705,8 @@ class TestProject(TestSlapOSGroupRoleSecurityMixin):
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', 'Assignee'])
self.assertRoles(project, self.user_id, ['Owner'])
class TestPDF(TestSlapOSGroupRoleSecurityMixin):
def test(self):
......
......@@ -52,6 +52,7 @@
<value>
<tuple>
<string>_setReference.*</string>
<string>_setDestinationDecision.*</string>
</tuple>
</value>
</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