Commit a7d72f2d authored by Romain Courteaud's avatar Romain Courteaud

slapos_erp5: fixup Account security

parent 523f0c3a
<local_roles_item> <local_roles_item>
<local_roles> <local_roles>
<role id='F-ACCOUNTING'> <role id='F-ACCOUNTING*'>
<item>Auditor</item> <item>Auditor</item>
<item>Author</item> <item>Author</item>
</role> </role>
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
</local_roles> </local_roles>
<local_role_group_ids> <local_role_group_ids>
<local_role_group_id id='function'> <local_role_group_id id='function'>
<principal id='F-ACCOUNTING'>Auditor</principal> <principal id='F-ACCOUNTING*'>Auditor</principal>
<principal id='F-ACCOUNTING'>Author</principal> <principal id='F-ACCOUNTING*'>Author</principal>
</local_role_group_id> </local_role_group_id>
<local_role_group_id id='shadow'> <local_role_group_id id='shadow'>
<principal id='R-SHADOW-PERSON'>Auditor</principal> <principal id='R-SHADOW-PERSON'>Auditor</principal>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<property id='title'>Accountant</property> <property id='title'>Accountant</property>
<property id='description'>Any accountant or accountant manager may create accounts and access accounts</property> <property id='description'>Any accountant or accountant manager may create accounts and access accounts</property>
<multi_property id='categories'>local_role_group/function</multi_property> <multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>function/accounting</multi_property> <multi_property id='category'>function/accounting*</multi_property>
<multi_property id='base_category'>function</multi_property> <multi_property id='base_category'>function</multi_property>
</role> </role>
<role id='Auditor'> <role id='Auditor'>
......
<type_roles> <type_roles>
<role id='Assignee'>
<property id='title'>Accountant Agent</property>
<multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>function/accounting/agent</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
<role id='Assignor'> <role id='Assignor'>
<property id='title'>Accountant</property> <property id='title'>Accountant Manager</property>
<property id='description'>Only the accountant can validate new accounts.</property> <property id='description'>Only the accountant can validate new accounts.</property>
<multi_property id='categories'>local_role_group/function</multi_property> <multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>function/accounting</multi_property> <multi_property id='category'>function/accounting/manager</multi_property>
<multi_property id='base_category'>function</multi_property> <multi_property id='base_category'>function</multi_property>
</role> </role>
<role id='Auditor'> <role id='Auditor'>
......
...@@ -1440,19 +1440,20 @@ class TestAccountModule(TestSlapOSGroupRoleSecurityMixin): ...@@ -1440,19 +1440,20 @@ class TestAccountModule(TestSlapOSGroupRoleSecurityMixin):
module = self.portal.account_module module = self.portal.account_module
self.changeOwnership(module) self.changeOwnership(module)
self.assertSecurityGroup(module, self.assertSecurityGroup(module,
['G-COMPANY', self.user_id, 'R-SHADOW-PERSON'], False) ['F-ACCOUNTING*', self.user_id, 'R-SHADOW-PERSON'], False)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author']) self.assertRoles(module, 'F-ACCOUNTING*', ['Auditor', 'Author'])
self.assertRoles(module, 'R-SHADOW-PERSON', ['Auditor']) self.assertRoles(module, 'R-SHADOW-PERSON', ['Auditor'])
self.assertRoles(module, self.user_id, ['Owner']) self.assertRoles(module, self.user_id, ['Owner'])
class TestAccount(TestSlapOSGroupRoleSecurityMixin): class TestAccount(TestSlapOSGroupRoleSecurityMixin):
def test_GroupCompany(self): def test_AccountingFunction(self):
product = self.portal.account_module.newContent( product = self.portal.account_module.newContent(
portal_type='Account') portal_type='Account')
product.updateLocalRolesOnSecurityGroups() product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product, self.assertSecurityGroup(product,
['G-COMPANY', self.user_id, 'R-SHADOW-PERSON'], False) ['F-ACCMAN', 'F-ACCAGT', self.user_id, 'R-SHADOW-PERSON'], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor']) self.assertRoles(product, 'F-ACCMAN', ['Assignor'])
self.assertRoles(product, 'F-ACCAGT', ['Assignee'])
self.assertRoles(product, 'R-SHADOW-PERSON', ['Auditor']) self.assertRoles(product, 'R-SHADOW-PERSON', ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner']) self.assertRoles(product, self.user_id, ['Owner'])
......
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