Commit 0985f9a8 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_erp5: Update Security (clean up)

    Drop an duplication, probably came from copy and paste
parent 9013c2c9
<type_roles> <type_roles>
<role id='Assignee'>
<property id='title'>Compute Node Agent</property>
<property id='description'>Monovalued role</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='categories'>local_role_group/computer</multi_property>
<multi_property id='base_category'>source_administration</multi_property>
</role>
<role id='Assignor'> <role id='Assignor'>
<property id='title'>Group company</property> <property id='title'>Group company</property>
<multi_property id='categories'>local_role_group/group</multi_property> <multi_property id='categories'>local_role_group/group</multi_property>
...@@ -20,10 +13,9 @@ ...@@ -20,10 +13,9 @@
</role> </role>
<role id='Assignee'> <role id='Assignee'>
<property id='title'>Person Owner</property> <property id='title'>Person Owner</property>
<property id='description'>XXX Review this</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'>source_administration</multi_property>
</role> </role>
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Person Shadow</property> <property id='title'>Person Shadow</property>
......
...@@ -315,7 +315,7 @@ class TestComputerNetwork(TestSlapOSGroupRoleSecurityMixin): ...@@ -315,7 +315,7 @@ class TestComputerNetwork(TestSlapOSGroupRoleSecurityMixin):
project.getReference()], False) project.getReference()], False)
self.assertRoles(network, 'G-COMPANY', ['Assignor']) self.assertRoles(network, 'G-COMPANY', ['Assignor'])
self.assertRoles(network, 'R-SHADOW-PERSON', ['Auditor']) self.assertRoles(network, 'R-SHADOW-PERSON', ['Auditor'])
self.assertRoles(network, self.user_id, ['Assignee', 'Owner']) self.assertRoles(network, self.user_id, ['Owner'])
self.assertRoles(network, person.getUserId(), ['Assignee']) self.assertRoles(network, person.getUserId(), ['Assignee'])
self.assertRoles(network, project.getReference(), ['Assignee']) self.assertRoles(network, project.getReference(), ['Assignee'])
...@@ -341,7 +341,7 @@ class TestComputerNetwork(TestSlapOSGroupRoleSecurityMixin): ...@@ -341,7 +341,7 @@ class TestComputerNetwork(TestSlapOSGroupRoleSecurityMixin):
organisation.getReference()], False) organisation.getReference()], False)
self.assertRoles(network, 'G-COMPANY', ['Assignor']) self.assertRoles(network, 'G-COMPANY', ['Assignor'])
self.assertRoles(network, 'R-SHADOW-PERSON', ['Auditor']) self.assertRoles(network, 'R-SHADOW-PERSON', ['Auditor'])
self.assertRoles(network, self.user_id, ['Assignee', 'Owner']) self.assertRoles(network, self.user_id, ['Owner'])
self.assertRoles(network, person.getUserId(), ['Assignee']) self.assertRoles(network, person.getUserId(), ['Assignee'])
self.assertRoles(network, organisation.getReference(), ['Assignee']) self.assertRoles(network, organisation.getReference(), ['Assignee'])
...@@ -353,21 +353,7 @@ class TestComputerNetwork(TestSlapOSGroupRoleSecurityMixin): ...@@ -353,21 +353,7 @@ class TestComputerNetwork(TestSlapOSGroupRoleSecurityMixin):
['G-COMPANY', 'R-SHADOW-PERSON', self.user_id], False) ['G-COMPANY', 'R-SHADOW-PERSON', self.user_id], False)
self.assertRoles(network, 'G-COMPANY', ['Assignor']) self.assertRoles(network, 'G-COMPANY', ['Assignor'])
self.assertRoles(network, 'R-SHADOW-PERSON', ['Auditor']) self.assertRoles(network, 'R-SHADOW-PERSON', ['Auditor'])
self.assertRoles(network, self.user_id, ['Assignee', 'Owner']) self.assertRoles(network, self.user_id, ['Owner'])
def test_ComputeNodeAgent(self):
reference = 'TESTPERSON-%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
network = self.portal.computer_network_module.newContent(
portal_type='Computer Network',
source_administration=person.getRelativeUrl())
network.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(network,
['G-COMPANY', 'R-SHADOW-PERSON', self.user_id, person.getUserId()], False)
self.assertRoles(network, person.getUserId(), ['Assignee'])
self.assertRoles(network, self.user_id, ['Assignee', 'Owner'])
class TestComputerNetworkModule(TestSlapOSGroupRoleSecurityMixin): class TestComputerNetworkModule(TestSlapOSGroupRoleSecurityMixin):
def test(self): def test(self):
...@@ -526,6 +512,7 @@ class TestInstanceTree(TestSlapOSGroupRoleSecurityMixin): ...@@ -526,6 +512,7 @@ class TestInstanceTree(TestSlapOSGroupRoleSecurityMixin):
reference = 'TESTHS-%s' % self.generateNewId() reference = 'TESTHS-%s' % self.generateNewId()
subscription = self.portal.instance_tree_module.newContent( subscription = self.portal.instance_tree_module.newContent(
portal_type='Instance Tree', reference=reference, portal_type='Instance Tree', reference=reference,
title=reference,
destination_section=person.getRelativeUrl()) destination_section=person.getRelativeUrl())
project = self.portal.project_module.newContent( project = self.portal.project_module.newContent(
portal_type='Project') portal_type='Project')
...@@ -552,6 +539,7 @@ class TestInstanceTree(TestSlapOSGroupRoleSecurityMixin): ...@@ -552,6 +539,7 @@ class TestInstanceTree(TestSlapOSGroupRoleSecurityMixin):
reference = 'TESTHS-%s' % self.generateNewId() reference = 'TESTHS-%s' % self.generateNewId()
subscription = self.portal.instance_tree_module.newContent( subscription = self.portal.instance_tree_module.newContent(
portal_type='Instance Tree', reference=reference, portal_type='Instance Tree', reference=reference,
title=reference,
destination_section=person.getRelativeUrl()) destination_section=person.getRelativeUrl())
organisation = self.portal.organisation_module.newContent( organisation = self.portal.organisation_module.newContent(
portal_type='Organisation', portal_type='Organisation',
...@@ -896,6 +884,7 @@ class TestSlaveInstance(TestSlapOSGroupRoleSecurityMixin): ...@@ -896,6 +884,7 @@ class TestSlaveInstance(TestSlapOSGroupRoleSecurityMixin):
subscription_reference = 'TESTHS-%s ' % self.generateNewId() subscription_reference = 'TESTHS-%s ' % self.generateNewId()
instance_tree = self.portal.instance_tree_module.newContent( instance_tree = self.portal.instance_tree_module.newContent(
portal_type='Instance Tree', portal_type='Instance Tree',
title="INSTTREETEST-%s" % self.generateNewId(),
reference=subscription_reference, reference=subscription_reference,
destination_section=customer.getRelativeUrl()) destination_section=customer.getRelativeUrl())
project = self.portal.project_module.newContent( project = self.portal.project_module.newContent(
...@@ -925,6 +914,7 @@ class TestSlaveInstance(TestSlapOSGroupRoleSecurityMixin): ...@@ -925,6 +914,7 @@ class TestSlaveInstance(TestSlapOSGroupRoleSecurityMixin):
subscription_reference = 'TESTHS-%s ' % self.generateNewId() subscription_reference = 'TESTHS-%s ' % self.generateNewId()
instance_tree = self.portal.instance_tree_module.newContent( instance_tree = self.portal.instance_tree_module.newContent(
portal_type='Instance Tree', portal_type='Instance Tree',
title="INSTTREETEST-%s" % self.generateNewId(),
reference=subscription_reference, reference=subscription_reference,
destination_section=customer.getRelativeUrl()) destination_section=customer.getRelativeUrl())
organisation = self.portal.organisation_module.newContent( organisation = self.portal.organisation_module.newContent(
...@@ -1132,6 +1122,7 @@ class TestSoftwareInstance(TestSlapOSGroupRoleSecurityMixin): ...@@ -1132,6 +1122,7 @@ class TestSoftwareInstance(TestSlapOSGroupRoleSecurityMixin):
subscription_reference = 'TESTHS-%s ' % self.generateNewId() subscription_reference = 'TESTHS-%s ' % self.generateNewId()
instance_tree = self.portal.instance_tree_module.newContent( instance_tree = self.portal.instance_tree_module.newContent(
portal_type='Instance Tree', portal_type='Instance Tree',
title="INSTTREETEST-%s" % self.generateNewId(),
reference=subscription_reference, reference=subscription_reference,
destination_section=customer.getRelativeUrl()) destination_section=customer.getRelativeUrl())
project = self.portal.project_module.newContent( project = self.portal.project_module.newContent(
...@@ -1161,6 +1152,7 @@ class TestSoftwareInstance(TestSlapOSGroupRoleSecurityMixin): ...@@ -1161,6 +1152,7 @@ class TestSoftwareInstance(TestSlapOSGroupRoleSecurityMixin):
subscription_reference = 'TESTHS-%s ' % self.generateNewId() subscription_reference = 'TESTHS-%s ' % self.generateNewId()
instance_tree = self.portal.instance_tree_module.newContent( instance_tree = self.portal.instance_tree_module.newContent(
portal_type='Instance Tree', portal_type='Instance Tree',
title="INSTTREETEST-%s" % self.generateNewId(),
reference=subscription_reference, reference=subscription_reference,
destination_section=customer.getRelativeUrl()) destination_section=customer.getRelativeUrl())
organisation = self.portal.organisation_module.newContent( organisation = self.portal.organisation_module.newContent(
...@@ -1958,6 +1950,8 @@ class TestMailMessage(TestSlapOSGroupRoleSecurityMixin): ...@@ -1958,6 +1950,8 @@ class TestMailMessage(TestSlapOSGroupRoleSecurityMixin):
person = self.makePerson(user=1) person = self.makePerson(user=1)
instance_tree = self.portal.instance_tree_module.newContent( instance_tree = self.portal.instance_tree_module.newContent(
portal_type='Instance Tree', portal_type='Instance Tree',
reference="INSTTREETEST-%s" % self.generateNewId(),
title="INSTTREETEST-%s" % self.generateNewId(),
destination_section=person.getRelativeUrl()) destination_section=person.getRelativeUrl())
project = self.portal.project_module.newContent( project = self.portal.project_module.newContent(
portal_type='Project') portal_type='Project')
...@@ -2033,6 +2027,8 @@ class TestMailMessage(TestSlapOSGroupRoleSecurityMixin): ...@@ -2033,6 +2027,8 @@ class TestMailMessage(TestSlapOSGroupRoleSecurityMixin):
person = self.makePerson(user=1) person = self.makePerson(user=1)
instance_tree = self.portal.instance_tree_module.newContent( instance_tree = self.portal.instance_tree_module.newContent(
portal_type='Instance Tree', portal_type='Instance Tree',
reference="INSTTREETEST-%s" % self.generateNewId(),
title="INSTTREETEST-%s" % self.generateNewId(),
destination_section=person.getRelativeUrl()) destination_section=person.getRelativeUrl())
organisation = self.portal.organisation_module.newContent( organisation = self.portal.organisation_module.newContent(
portal_type='Organisation', portal_type='Organisation',
...@@ -2305,6 +2301,8 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin): ...@@ -2305,6 +2301,8 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
person = self.makePerson(user=1) person = self.makePerson(user=1)
instance_tree = self.portal.instance_tree_module.newContent( instance_tree = self.portal.instance_tree_module.newContent(
portal_type='Instance Tree', portal_type='Instance Tree',
reference="INSTTREETEST-%s" % self.generateNewId(),
title="INSTTREETEST-%s" % self.generateNewId(),
destination_section=person.getRelativeUrl()) destination_section=person.getRelativeUrl())
project = self.portal.project_module.newContent( project = self.portal.project_module.newContent(
portal_type='Project') portal_type='Project')
...@@ -2364,6 +2362,8 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin): ...@@ -2364,6 +2362,8 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
person = self.makePerson(user=1) person = self.makePerson(user=1)
instance_tree = self.portal.instance_tree_module.newContent( instance_tree = self.portal.instance_tree_module.newContent(
portal_type='Instance Tree', portal_type='Instance Tree',
reference="INSTTREETEST-%s" % self.generateNewId(),
title="INSTTREETEST-%s" % self.generateNewId(),
destination_section=person.getRelativeUrl()) destination_section=person.getRelativeUrl())
organisation = self.portal.organisation_module.newContent( organisation = self.portal.organisation_module.newContent(
portal_type='Organisation', portal_type='Organisation',
...@@ -2804,6 +2804,8 @@ class TestUpgradeDecision(TestSlapOSGroupRoleSecurityMixin): ...@@ -2804,6 +2804,8 @@ class TestUpgradeDecision(TestSlapOSGroupRoleSecurityMixin):
person = self.makePerson(user=1) person = self.makePerson(user=1)
instance_tree = self.portal.instance_tree_module.newContent( instance_tree = self.portal.instance_tree_module.newContent(
portal_type='Instance Tree', portal_type='Instance Tree',
reference="INSTTREETEST-%s" % self.generateNewId(),
title="INSTTREETEST-%s" % self.generateNewId(),
destination_section=person.getRelativeUrl()) destination_section=person.getRelativeUrl())
project = self.portal.project_module.newContent( project = self.portal.project_module.newContent(
portal_type='Project') portal_type='Project')
...@@ -2868,6 +2870,8 @@ class TestUpgradeDecision(TestSlapOSGroupRoleSecurityMixin): ...@@ -2868,6 +2870,8 @@ class TestUpgradeDecision(TestSlapOSGroupRoleSecurityMixin):
person = self.makePerson(user=1) person = self.makePerson(user=1)
instance_tree = self.portal.instance_tree_module.newContent( instance_tree = self.portal.instance_tree_module.newContent(
portal_type='Instance Tree', portal_type='Instance Tree',
reference="INSTTREETEST-%s" % self.generateNewId(),
title="INSTTREETEST-%s" % self.generateNewId(),
destination_section=person.getRelativeUrl()) destination_section=person.getRelativeUrl())
organisation = self.portal.organisation_module.newContent( organisation = self.portal.organisation_module.newContent(
portal_type='Organisation', portal_type='Organisation',
......
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