Commit d6f42777 authored by Romain Courteaud's avatar Romain Courteaud

slapos_erp5: update Accounting/Balance Transaction security

parent 031d0cc1
...@@ -3,14 +3,21 @@ ...@@ -3,14 +3,21 @@
<property id='title'>ReadOnly for Accountant</property> <property id='title'>ReadOnly for Accountant</property>
<property id='condition'>python: context.getLedger("") == "automated"</property> <property id='condition'>python: context.getLedger("") == "automated"</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>
</role>
<role id='Assignee'>
<property id='title'>Writable for Accountant Agent</property>
<property id='condition'>python: context.getLedger("") != "automated"</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> <multi_property id='base_category'>function</multi_property>
</role> </role>
<role id='Assignor'> <role id='Assignor'>
<property id='title'>Writable for Accountant</property> <property id='title'>Writable for Accountant Manager</property>
<property id='condition'>python: context.getLedger("") != "automated"</property> <property id='condition'>python: context.getLedger("") != "automated"</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>
</type_roles> </type_roles>
\ No newline at end of file
...@@ -3,14 +3,21 @@ ...@@ -3,14 +3,21 @@
<property id='title'>ReadOnly for Accountant</property> <property id='title'>ReadOnly for Accountant</property>
<property id='condition'>python: context.getLedger("") == "automated"</property> <property id='condition'>python: context.getLedger("") == "automated"</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>
</role>
<role id='Assignee'>
<property id='title'>Writable for Accountant Agent</property>
<property id='condition'>python: context.getLedger("") != "automated"</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> <multi_property id='base_category'>function</multi_property>
</role> </role>
<role id='Assignor'> <role id='Assignor'>
<property id='title'>Writable for Accountant</property> <property id='title'>Writable for Accountant Manager</property>
<property id='condition'>python: context.getLedger("") != "automated"</property> <property id='condition'>python: context.getLedger("") != "automated"</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>
</type_roles> </type_roles>
\ No newline at end of file
...@@ -1304,23 +1304,45 @@ class TestAccountingTransactionModule(TestSlapOSGroupRoleSecurityMixin): ...@@ -1304,23 +1304,45 @@ class TestAccountingTransactionModule(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(module, self.user_id, ['Owner']) self.assertRoles(module, self.user_id, ['Owner'])
class TestAccountingTransaction(TestSlapOSGroupRoleSecurityMixin): class TestAccountingTransaction(TestSlapOSGroupRoleSecurityMixin):
def test_GroupCompany(self): def test_AccountingFunction_LedgerNotAutomated(self):
product = self.portal.accounting_module.newContent( product = self.portal.accounting_module.newContent(
portal_type='Accounting Transaction') portal_type='Accounting Transaction')
product.updateLocalRolesOnSecurityGroups() product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product, self.assertSecurityGroup(product,
['G-COMPANY', self.user_id], False) ['F-ACCMAN', 'F-ACCAGT', self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor']) self.assertRoles(product, 'F-ACCMAN', ['Assignor'])
self.assertRoles(product, 'F-ACCAGT', ['Assignee'])
self.assertRoles(product, self.user_id, ['Owner'])
def test_AccountingFunction_LedgerAutomated(self):
product = self.portal.accounting_module.newContent(
portal_type='Accounting Transaction')
product.edit(ledger='automated')
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['F-ACCOUNTING*', self.user_id], False)
self.assertRoles(product, 'F-ACCOUNTING*', ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner']) self.assertRoles(product, self.user_id, ['Owner'])
class TestBalanceTransaction(TestSlapOSGroupRoleSecurityMixin): class TestBalanceTransaction(TestSlapOSGroupRoleSecurityMixin):
def test_GroupCompany(self): def test_AccountingFunction_LedgerNotAutomated(self):
product = self.portal.accounting_module.newContent( product = self.portal.accounting_module.newContent(
portal_type='Balance Transaction') portal_type='Balance Transaction')
product.updateLocalRolesOnSecurityGroups() product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product, self.assertSecurityGroup(product,
['G-COMPANY', self.user_id], False) ['F-ACCMAN', 'F-ACCAGT', self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor']) self.assertRoles(product, 'F-ACCMAN', ['Assignor'])
self.assertRoles(product, 'F-ACCAGT', ['Assignee'])
self.assertRoles(product, self.user_id, ['Owner'])
def test_AccountingFunction_LedgerAutomated(self):
product = self.portal.accounting_module.newContent(
portal_type='Balance Transaction')
product.edit(ledger='automated')
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['F-ACCOUNTING*', self.user_id], False)
self.assertRoles(product, 'F-ACCOUNTING*', ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner']) self.assertRoles(product, self.user_id, ['Owner'])
class TestPaymentTransaction(TestSlapOSGroupRoleSecurityMixin): class TestPaymentTransaction(TestSlapOSGroupRoleSecurityMixin):
......
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