Commit 23e6ac3c authored by Romain Courteaud's avatar Romain Courteaud

slapos_erp5: test Instance Tree security

parent 8947dba6
......@@ -441,11 +441,9 @@ class TestInstanceTree(TestSlapOSGroupRoleSecurityMixin):
portal_type='Instance Tree', reference=reference)
subscription.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(subscription, [self.user_id, reference,
'G-COMPANY'], False)
self.assertSecurityGroup(subscription, [self.user_id, reference], False)
self.assertRoles(subscription, reference, ['Assignee'])
self.assertRoles(subscription, self.user_id, ['Owner'])
self.assertRoles(subscription, 'G-COMPANY', ['Assignor'])
def test_CustomOfTheInstanceTree(self):
customer_reference = 'TESTPERSON-%s' % self.generateNewId()
......@@ -458,67 +456,27 @@ class TestInstanceTree(TestSlapOSGroupRoleSecurityMixin):
subscription.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(subscription, [self.user_id, reference,
customer.getUserId(), 'G-COMPANY'], False)
customer.getUserId()], False)
self.assertRoles(subscription, reference, ['Assignee'])
self.assertRoles(subscription, customer.getUserId(), ['Assignee'])
self.assertRoles(subscription, self.user_id, ['Owner'])
self.assertRoles(subscription, 'G-COMPANY', ['Assignor'])
def test_ProjectMember(self):
project = self.addProject()
person = self.makePerson(project, user=1)
reference = 'TESTHS-%s' % self.generateNewId()
subscription = self.portal.instance_tree_module.newContent(
portal_type='Instance Tree', reference=reference,
title=reference,
destination_section=person.getRelativeUrl())
project = self.portal.project_module.newContent(
portal_type='Project')
self.tic()
self.login(person.getUserId())
subscription.InstanceTree_createMovement(
destination_project=project.getRelativeUrl())
self.login()
self.tic()
subscription.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(subscription, [self.user_id, reference,
person.getUserId(), 'G-COMPANY', project.getReference()], False)
self.assertRoles(subscription, reference, ['Assignee'])
self.assertRoles(subscription, person.getUserId(), ['Assignee'])
self.assertRoles(subscription, self.user_id, ['Owner'])
self.assertRoles(subscription, 'G-COMPANY', ['Assignor'])
self.assertRoles(subscription, project.getReference(), ['Assignee'])
def test_OrganisationMember(self):
project = self.addProject()
person = self.makePerson(project, user=1)
reference = 'TESTHS-%s' % self.generateNewId()
subscription = self.portal.instance_tree_module.newContent(
portal_type='Instance Tree', reference=reference,
title=reference,
destination_section=person.getRelativeUrl())
organisation = self.portal.organisation_module.newContent(
portal_type='Organisation',
reference="TESTO-%s" % self.generateNewId())
self.tic()
self.login(person.getUserId())
subscription.InstanceTree_createMovement(
destination=organisation.getRelativeUrl())
self.login()
self.tic()
follow_up_value=project)
subscription.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(subscription, [self.user_id, reference,
person.getUserId(), 'G-COMPANY', organisation.getReference()], False)
'%s_F-PRODAGNT' % project.getReference(),
'%s_F-PRODMAN' % project.getReference()], False)
self.assertRoles(subscription, reference, ['Assignee'])
self.assertRoles(subscription, person.getUserId(), ['Assignee'])
self.assertRoles(subscription, self.user_id, ['Owner'])
self.assertRoles(subscription, 'G-COMPANY', ['Assignor'])
self.assertRoles(subscription, organisation.getReference(), ['Assignee'])
self.assertRoles(subscription, '%s_F-PRODMAN' % project.getReference(), ['Assignor'])
self.assertRoles(subscription, '%s_F-PRODAGNT' % project.getReference(), ['Assignee'])
class TestInstanceTreeModule(TestSlapOSGroupRoleSecurityMixin):
......@@ -526,11 +484,11 @@ class TestInstanceTreeModule(TestSlapOSGroupRoleSecurityMixin):
module = self.portal.instance_tree_module
self.changeOwnership(module)
self.assertSecurityGroup(module,
['G-COMPANY', 'R-COMPUTER', 'R-MEMBER', 'R-INSTANCE', self.user_id], False)
self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author'])
['F-PRODUCTION*', 'R-COMPUTER', 'F-CUSTOMER', 'R-INSTANCE', self.user_id], False)
self.assertRoles(module, 'F-CUSTOMER', ['Auditor', 'Author'])
self.assertRoles(module, 'R-COMPUTER', ['Auditor'])
self.assertRoles(module, 'R-INSTANCE', ['Auditor'])
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
self.assertRoles(module, 'F-PRODUCTION*', ['Auditor'])
self.assertRoles(module, self.user_id, ['Owner'])
class TestOrganisation(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