Commit 1b5ac0fb authored by Romain Courteaud's avatar Romain Courteaud

slapos_erp5:

* test Regularisation Request local roles
* test Computer Model local roles
* test Computer Network local roles
* drop Computer Module local roles
  Computer was not reachable, so, no reason to keep this module
* test System Event module local roles
* test Upgrade Decision local roles
parent 50e2479d
<local_roles_item>
<local_roles>
<role id='G-COMPANY'>
<role id='F-CUSTOMER'>
<item>Auditor</item>
<item>Author</item>
</role>
<role id='R-MEMBER'>
<role id='F-PRODUCTION*'>
<item>Auditor</item>
<item>Author</item>
</role>
<role id='R-SHADOW-PERSON'>
<item>Auditor</item>
</role>
</local_roles>
<local_role_group_ids>
<local_role_group_id id='group'>
<principal id='G-COMPANY'>Auditor</principal>
<principal id='G-COMPANY'>Author</principal>
<local_role_group_id id='function'>
<principal id='F-CUSTOMER'>Auditor</principal>
</local_role_group_id>
<local_role_group_id id='user'>
<principal id='R-MEMBER'>Auditor</principal>
<principal id='R-MEMBER'>Author</principal>
<local_role_group_id id='shadow'>
<principal id='R-SHADOW-PERSON'>Auditor</principal>
</local_role_group_id>
</local_role_group_ids>
</local_roles_item>
\ No newline at end of file
<local_roles_item>
<local_roles>
<role id='G-COMPANY'>
<item>Auditor</item>
</role>
<role id='R-COMPUTER'>
<item>Auditor</item>
</role>
<role id='R-MEMBER'>
<item>Auditor</item>
</role>
</local_roles>
<local_role_group_ids>
<local_role_group_id id='computer'>
<principal id='R-COMPUTER'>Auditor</principal>
</local_role_group_id>
<local_role_group_id id='group'>
<principal id='G-COMPANY'>Auditor</principal>
</local_role_group_id>
<local_role_group_id id='user'>
<principal id='R-MEMBER'>Auditor</principal>
</local_role_group_id>
</local_role_group_ids>
</local_roles_item>
\ No newline at end of file
<local_roles_item>
<local_roles>
<role id='G-COMPANY'>
<item>Assignor</item>
</role>
<role id='R-MEMBER'>
<item>Auditor</item>
</role>
</local_roles>
<local_role_group_ids>
<local_role_group_id id='group'>
<principal id='G-COMPANY'>Assignor</principal>
</local_role_group_id>
<local_role_group_id id='user'>
<principal id='R-MEMBER'>Auditor</principal>
</local_role_group_id>
......
<type_roles>
<role id='Auditor; Author'>
<property id='title'>Group Company</property>
<multi_property id='categories'>local_role_group/group</multi_property>
<multi_property id='category'>group/company</multi_property>
<multi_property id='base_category'>group</multi_property>
</role>
<role id='Auditor; Author'>
<role id='Auditor'>
<property id='title'>Member</property>
<multi_property id='categories'>local_role_group/user</multi_property>
<multi_property id='category'>role/member</multi_property>
<multi_property id='categories'>local_role_group/function</multi_property>
<multi_property id='category'>function/customer</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Person Shadow</property>
<multi_property id='categories'>local_role_group/shadow</multi_property>
<multi_property id='category'>role/shadow/person</multi_property>
<multi_property id='base_category'>role</multi_property>
</role>
<role id='Auditor; Author'>
<property id='title'>Production</property>
<multi_property id='category'>function/production*</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
</type_roles>
\ No newline at end of file
<type_roles>
<role id='Auditor'>
<property id='title'>Person Shadow</property>
<multi_property id='categories'>local_role_group/shadow</multi_property>
<multi_property id='category'>role/shadow/person</multi_property>
<multi_property id='base_category'>role</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Project Customer</property>
<property id='description'>XXX add local role group</property>
<property id='condition'>python: context.getFollowUp("") != ""</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='category'>function/customer</multi_property>
<multi_property id='base_category'>follow_up</multi_property>
</role>
<role id='Assignee'>
<property id='title'>Compute Node Agent</property>
<property id='description'>Monovalued role</property>
<property id='title'>Project Production Agent</property>
<property id='description'>XXX add local role group</property>
<property id='condition'>python: context.getFollowUp("") != ""</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_administration</multi_property>
<multi_property id='category'>function/production/agent</multi_property>
<multi_property id='base_category'>follow_up</multi_property>
</role>
<role id='Assignor'>
<property id='title'>Group company</property>
<multi_property id='categories'>local_role_group/group</multi_property>
<multi_property id='category'>group/company</multi_property>
<multi_property id='base_category'>group</multi_property>
<property id='title'>Project Production Manager</property>
<property id='description'>XXX add local role group</property>
<property id='condition'>python: context.getFollowUp("") != ""</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='category'>function/production/manager</multi_property>
<multi_property id='base_category'>follow_up</multi_property>
</role>
</type_roles>
\ No newline at end of file
<type_roles>
<role id='Auditor'>
<property id='title'>Compute Node</property>
<multi_property id='categories'>local_role_group/computer</multi_property>
<multi_property id='category'>role/computer</multi_property>
<multi_property id='base_category'>role</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Group company</property>
<multi_property id='categories'>local_role_group/group</multi_property>
<multi_property id='category'>group/company</multi_property>
<multi_property id='base_category'>group</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Member</property>
<multi_property id='categories'>local_role_group/user</multi_property>
<multi_property id='category'>role/member</multi_property>
<multi_property id='base_category'>role</multi_property>
</role>
</type_roles>
\ No newline at end of file
......@@ -36,6 +36,7 @@
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='category'>function/production/agent</multi_property>
<multi_property id='base_category'>source_project</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
<role id='Assignor'>
<property id='title'>Source Project Production Manager</property>
......@@ -44,5 +45,6 @@
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='category'>function/production/manager</multi_property>
<multi_property id='base_category'>source_project</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
</type_roles>
\ No newline at end of file
......@@ -22,6 +22,7 @@
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='category'>function/production/agent</multi_property>
<multi_property id='base_category'>source_project</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
<role id='Assignor'>
<property id='title'>Source Project Production Manager</property>
......@@ -30,6 +31,7 @@
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='category'>function/production/manager</multi_property>
<multi_property id='base_category'>source_project</multi_property>
<multi_property id='base_category'>function</multi_property>
</role>
<role id='Assignee'>
<property id='title'>User</property>
......
......@@ -134,51 +134,49 @@ class TestComputeNode(TestSlapOSGroupRoleSecurityMixin):
class TestComputerModel(TestSlapOSGroupRoleSecurityMixin):
def test_GroupCompany(self):
model = self.portal.computer_model_module.newContent(
portal_type='Computer Model')
document_portal_type = 'Computer Model'
def test_default(self):
model = self.portal.getDefaultModuleValue(self.document_portal_type).newContent(
portal_type=self.document_portal_type)
model.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(model,
['G-COMPANY', self.user_id], False)
self.assertRoles(model, 'G-COMPANY', ['Assignor'])
['R-SHADOW-PERSON', self.user_id], False)
self.assertRoles(model, 'R-SHADOW-PERSON', ['Auditor'])
self.assertRoles(model, self.user_id, ['Owner'])
def test_ComputeNodeAgent(self):
reference = 'TESTPERSON-%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
model = self.portal.computer_model_module.newContent(
portal_type='Computer Model',
source_administration=person.getRelativeUrl())
model.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(model,
['G-COMPANY', self.user_id, person.getUserId()], False)
self.assertRoles(model, person.getUserId(), ['Assignee'])
self.assertRoles(model, self.user_id, ['Owner'])
def test_ProjectMember(self):
project = self.addProject()
compute_node = self.portal.getDefaultModuleValue(self.document_portal_type).newContent(
portal_type=self.document_portal_type,
follow_up_value=project)
compute_node.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(compute_node, [
self.user_id,
'R-SHADOW-PERSON',
'%s_F-PRODAGNT' % project.getReference(),
'%s_F-PRODMAN' % project.getReference(),
'%s_F-CUSTOMER' % project.getReference(),
], False)
self.assertRoles(compute_node, self.user_id, ['Owner'])
self.assertRoles(compute_node, 'R-SHADOW-PERSON', ['Auditor'])
self.assertRoles(compute_node, '%s_F-PRODAGNT' % project.getReference(), ['Assignee'])
self.assertRoles(compute_node, '%s_F-PRODMAN' % project.getReference(), ['Assignor'])
self.assertRoles(compute_node, '%s_F-CUSTOMER' % project.getReference(), ['Auditor'])
class TestComputerModelModule(TestSlapOSGroupRoleSecurityMixin):
def test(self):
module = self.portal.computer_model_module
self.changeOwnership(module)
self.assertSecurityGroup(module,
['G-COMPANY', 'R-MEMBER', self.user_id], False)
self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author'])
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
self.assertRoles(module, self.user_id, ['Owner'])
class TestComputerModule(TestSlapOSGroupRoleSecurityMixin):
def test(self):
module = self.portal.computer_module
self.changeOwnership(module)
self.assertSecurityGroup(module,
['G-COMPANY', 'R-COMPUTER', 'R-MEMBER', 'R-SHADOW-PERSON', self.user_id],
['F-PRODUCTION*', 'F-CUSTOMER', 'R-SHADOW-PERSON', self.user_id],
False)
self.assertRoles(module, 'R-MEMBER', ['Auditor'])
self.assertRoles(module, 'G-COMPANY', ['Auditor'])
self.assertRoles(module, 'R-COMPUTER', ['Auditor'])
self.assertRoles(module, 'F-CUSTOMER', ['Auditor'])
self.assertRoles(module, 'F-PRODUCTION*', ['Auditor', 'Author'])
self.assertRoles(module, 'R-SHADOW-PERSON', ['Auditor'])
self.assertRoles(module, self.user_id, ['Owner'])
class TestComputeNodeModule(TestSlapOSGroupRoleSecurityMixin):
def test(self):
module = self.portal.compute_node_module
......@@ -193,79 +191,19 @@ class TestComputeNodeModule(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(module, self.user_id, ['Owner'])
class TestComputerNetwork(TestSlapOSGroupRoleSecurityMixin):
class TestComputerNetwork(TestComputerModel):
document_portal_type = 'Computer Network'
def test_ProjectMember(self):
project = self.addProject()
person = self.makePerson(project, user=1)
network = self.portal.computer_network_module.newContent(
portal_type='Computer Network',
source_administration=person.getRelativeUrl())
project = self.portal.project_module.newContent(
portal_type='Project')
self.tic()
self.login(person.getUserId())
network.ComputerNetwork_createMovement(
destination_project=project.getRelativeUrl())
self.login()
self.tic()
network.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(network,
['G-COMPANY', 'R-SHADOW-PERSON', self.user_id, person.getUserId(),
project.getReference()], False)
self.assertRoles(network, 'G-COMPANY', ['Assignor'])
self.assertRoles(network, 'R-SHADOW-PERSON', ['Auditor'])
self.assertRoles(network, self.user_id, ['Owner'])
self.assertRoles(network, person.getUserId(), ['Assignee'])
self.assertRoles(network, project.getReference(), ['Assignee'])
def test_OrganisationMember(self):
project = self.addProject()
person = self.makePerson(project, user=1)
network = self.portal.computer_network_module.newContent(
portal_type='Computer Network',
source_administration=person.getRelativeUrl())
organisation = self.portal.organisation_module.newContent(
portal_type='Organisation',
reference="TESTO-%s" % self.generateNewId())
self.tic()
self.login(person.getUserId())
network.ComputerNetwork_createMovement(
destination_section=organisation.getRelativeUrl())
self.login()
self.tic()
network.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(network,
['G-COMPANY', 'R-SHADOW-PERSON', self.user_id, person.getUserId(),
organisation.getReference()], False)
self.assertRoles(network, 'G-COMPANY', ['Assignor'])
self.assertRoles(network, 'R-SHADOW-PERSON', ['Auditor'])
self.assertRoles(network, self.user_id, ['Owner'])
self.assertRoles(network, person.getUserId(), ['Assignee'])
self.assertRoles(network, organisation.getReference(), ['Assignee'])
def test_GroupCompany(self):
network = self.portal.computer_network_module.newContent(
portal_type='Computer Network')
network.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(network,
['G-COMPANY', 'R-SHADOW-PERSON', self.user_id], False)
self.assertRoles(network, 'G-COMPANY', ['Assignor'])
self.assertRoles(network, 'R-SHADOW-PERSON', ['Auditor'])
self.assertRoles(network, self.user_id, ['Owner'])
class TestComputerNetworkModule(TestSlapOSGroupRoleSecurityMixin):
def test(self):
module = self.portal.computer_network_module
self.changeOwnership(module)
self.assertSecurityGroup(module,
['G-COMPANY', 'R-MEMBER', 'R-SHADOW-PERSON', self.user_id], False)
self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author'])
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
['F-PRODUCTION*', 'F-CUSTOMER', 'R-SHADOW-PERSON', self.user_id],
False)
self.assertRoles(module, 'F-CUSTOMER', ['Auditor'])
self.assertRoles(module, 'F-PRODUCTION*', ['Auditor', 'Author'])
self.assertRoles(module, 'R-SHADOW-PERSON', ['Auditor'])
self.assertRoles(module, self.user_id, ['Owner'])
......@@ -1494,9 +1432,11 @@ class TestSupportRequestModule(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(module, self.user_id, ['Owner'])
class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
def test_GroupCompany(self):
support_request = self.portal.support_request_module.newContent(
portal_type='Support Request')
ticket_portal_type = 'Support Request'
def test_default(self):
support_request = self.portal.getDefaultModuleValue(self.ticket_portal_type).newContent(
portal_type=self.ticket_portal_type)
support_request.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(support_request,
[self.user_id], False)
......@@ -1506,8 +1446,8 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
reference = 'TESTPERSON-%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
support_request = self.portal.support_request_module.newContent(
portal_type='Support Request',
support_request = self.portal.getDefaultModuleValue(self.ticket_portal_type).newContent(
portal_type=self.ticket_portal_type,
destination_decision_value=person,
)
support_request.updateLocalRolesOnSecurityGroups()
......@@ -1517,9 +1457,11 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(support_request, self.user_id, ['Owner'])
def test_Template(self):
support_request = self.portal.restrictedTraverse(
self.portal.portal_preferences.getPreferredSupportRequestTemplate())
assert support_request.getPortalType() == 'Support Request'
support_request = self.portal.restrictedTraverse(getattr(
self.portal.portal_preferences,
'getPreferred%sTemplate' % self.ticket_portal_type.title().replace(' ', '')
)())
assert support_request.getPortalType() == self.ticket_portal_type
support_request.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(support_request,
[support_request.Base_getOwnerId(), 'R-MEMBER'], False)
......@@ -1530,8 +1472,8 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
def test_SourceProject(self):
project = self.addProject()
support_request = self.portal.support_request_module.newContent(
portal_type='Support Request',
support_request = self.portal.getDefaultModuleValue(self.ticket_portal_type).newContent(
portal_type=self.ticket_portal_type,
source_project_value=project)
support_request.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(support_request, [self.user_id,
......@@ -1543,8 +1485,8 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
def test_DestinationProject(self):
project = self.addProject()
support_request = self.portal.support_request_module.newContent(
portal_type='Support Request',
support_request = self.portal.getDefaultModuleValue(self.ticket_portal_type).newContent(
portal_type=self.ticket_portal_type,
destination_project_value=project)
support_request.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(support_request, [self.user_id,
......@@ -1621,13 +1563,13 @@ class TestSystemEventModule(TestSlapOSGroupRoleSecurityMixin):
module = self.portal.system_event_module
self.changeOwnership(module)
self.assertSecurityGroup(module,
['R-SHADOW-PERSON', self.user_id, 'G-COMPANY'], False)
['R-SHADOW-PERSON', self.user_id, 'F-IS*'], False)
self.assertRoles(module, 'R-SHADOW-PERSON', ['Author'])
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
self.assertRoles(module, 'F-IS*', ['Auditor'])
self.assertRoles(module, self.user_id, ['Owner'])
class TestPayzenEvent(TestSlapOSGroupRoleSecurityMixin):
def test_GroupCompany(self):
def test_default(self):
event = self.portal.system_event_module.newContent(
portal_type='Payzen Event')
event.updateLocalRolesOnSecurityGroups()
......@@ -1654,7 +1596,7 @@ class TestPayzenEvent(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(event, self.user_id, ['Owner'])
class TestWechatEvent(TestSlapOSGroupRoleSecurityMixin):
def test_GroupCompany(self):
def test_default(self):
event = self.portal.system_event_module.newContent(
portal_type='Wechat Event')
event.updateLocalRolesOnSecurityGroups()
......@@ -1722,48 +1664,13 @@ class TestRegularisationRequestModule(TestSlapOSGroupRoleSecurityMixin):
module = self.portal.regularisation_request_module
self.changeOwnership(module)
self.assertSecurityGroup(module,
['G-COMPANY', 'R-MEMBER', self.user_id], False)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
self.assertRoles(module, 'R-MEMBER', ['Auditor'])
['F-PRODUCTION*', 'F-CUSTOMER', self.user_id], True)
self.assertRoles(module, 'F-PRODUCTION*', ['Auditor'])
self.assertRoles(module, 'F-CUSTOMER', ['Auditor'])
self.assertRoles(module, self.user_id, ['Owner'])
class TestRegularisationRequest(TestSlapOSGroupRoleSecurityMixin):
def test_GroupCompany(self):
product = self.portal.regularisation_request_module.newContent(
portal_type='Regularisation Request')
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, self.user_id, ['Owner'])
def test_Customer(self):
reference = 'TESTPERSON-%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
product = self.portal.regularisation_request_module.newContent(
portal_type='Regularisation Request',
destination_decision_value=person,
)
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', person.getUserId(), self.user_id], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, person.getUserId(), ['Auditor'])
self.assertRoles(product, self.user_id, ['Owner'])
def test_Template(self):
product = self.portal.restrictedTraverse(
self.portal.portal_preferences.getPreferredRegularisationRequestTemplate())
assert product.getPortalType() == 'Regularisation Request'
product.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(product,
['G-COMPANY', product.Base_getOwnerId(), 'R-MEMBER'], False)
self.assertRoles(product, 'G-COMPANY', ['Assignor'])
self.assertRoles(product, product.Base_getOwnerId(), ['Owner'])
self.assertRoles(product, 'R-MEMBER', ['Auditor'])
self.assertPermissionsOfRole(product, 'Auditor',
['Access contents information', 'View'])
class TestRegularisationRequest(TestSupportRequest):
ticket_portal_type = 'Regularisation Request'
class TestInvitationTokenModule(TestSlapOSGroupRoleSecurityMixin):
def test(self):
......@@ -1923,328 +1830,58 @@ class TestUpgradeDecisionModule(TestSlapOSGroupRoleSecurityMixin):
module = self.portal.upgrade_decision_module
self.changeOwnership(module)
self.assertSecurityGroup(module,
['G-COMPANY', 'R-MEMBER', self.user_id], True)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
self.assertRoles(module, 'R-MEMBER', ['Auditor', 'Author'])
['F-PRODUCTION*', 'F-CUSTOMER', self.user_id], True)
self.assertRoles(module, 'F-PRODUCTION*', ['Auditor'])
self.assertRoles(module, 'F-CUSTOMER', ['Auditor'])
self.assertRoles(module, self.user_id, ['Owner'])
class TestUpgradeDecision(TestSlapOSGroupRoleSecurityMixin):
def test_GroupCompany(self):
upgrade_decision = self.portal.upgrade_decision_module.newContent(
portal_type='Upgrade Decision')
upgrade_decision.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(upgrade_decision,
['G-COMPANY', self.user_id], False)
self.assertRoles(upgrade_decision, 'G-COMPANY', ['Assignor'])
self.assertRoles(upgrade_decision, self.user_id, ['Owner'])
ticket_portal_type = 'Upgrade Decision'
def test_default(self):
support_request = self.portal.getDefaultModuleValue(self.ticket_portal_type).newContent(
portal_type=self.ticket_portal_type)
support_request.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(support_request,
[self.user_id], False)
self.assertRoles(support_request, self.user_id, ['Owner'])
def test_Customer(self):
reference = 'TESTPERSON-%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
reference=reference)
upgrade_decision = self.portal.upgrade_decision_module.newContent(
portal_type='Upgrade Decision',
support_request = self.portal.getDefaultModuleValue(self.ticket_portal_type).newContent(
portal_type=self.ticket_portal_type,
destination_decision_value=person,
)
upgrade_decision.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(upgrade_decision,
['G-COMPANY', person.getUserId(), self.user_id], False)
self.assertRoles(upgrade_decision, 'G-COMPANY', ['Assignor'])
self.assertRoles(upgrade_decision, person.getUserId(), ['Assignee'])
self.assertRoles(upgrade_decision, self.user_id, ['Owner'])
def test_ProjectMember(self):
project = self.addProject()
person = self.makePerson(project, user=1)
compute_node = self.portal.compute_node_module.newContent(
portal_type='Compute Node',
source_administration=person.getRelativeUrl())
project = self.portal.project_module.newContent(
portal_type='Project')
self.tic()
self.login(person.getUserId())
compute_node.ComputeNode_createMovement(
destination=person.getRelativeUrl(),
destination_project=project.getRelativeUrl())
self.login()
self.tic()
upgrade_decision = self.portal.upgrade_decision_module.newContent(
portal_type='Upgrade Decision',
destination_decision_value=person)
upgrade_decision.newContent(
portal_type="Upgrade Decision Line",
aggregate=compute_node.getRelativeUrl()
)
upgrade_decision.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(upgrade_decision,
['G-COMPANY', person.getUserId(), self.user_id, project.getReference()], False)
self.assertRoles(upgrade_decision, 'G-COMPANY', ['Assignor'])
self.assertRoles(upgrade_decision, person.getUserId(), ['Assignee'])
self.assertRoles(upgrade_decision, self.user_id, ['Owner'])
self.assertRoles(upgrade_decision, project.getReference(), ['Assignee'])
def test_ProjectMember_InstanceTree(self):
project = self.addProject()
person = self.makePerson(project, user=1)
instance_tree = self.portal.instance_tree_module.newContent(
portal_type='Instance Tree',
reference="INSTTREETEST-%s" % self.generateNewId(),
title="INSTTREETEST-%s" % self.generateNewId(),
destination_section=person.getRelativeUrl(),
follow_up_value=project)
project = self.portal.project_module.newContent(
portal_type='Project')
self.tic()
self.login(person.getUserId())
instance_tree.InstanceTree_createMovement(
destination_project=project.getRelativeUrl())
self.login()
self.tic()
upgrade_decision = self.portal.upgrade_decision_module.newContent(
portal_type='Upgrade Decision',
destination_decision_value=person)
upgrade_decision.newContent(
portal_type="Upgrade Decision Line",
aggregate=instance_tree.getRelativeUrl()
)
upgrade_decision.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(upgrade_decision,
['G-COMPANY', person.getUserId(), self.user_id, project.getReference()], False)
self.assertRoles(upgrade_decision, 'G-COMPANY', ['Assignor'])
self.assertRoles(upgrade_decision, person.getUserId(), ['Assignee'])
self.assertRoles(upgrade_decision, self.user_id, ['Owner'])
self.assertRoles(upgrade_decision, project.getReference(), ['Assignee'])
support_request.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(support_request,
[person.getUserId(), self.user_id], False)
self.assertRoles(support_request, person.getUserId(), ['Assignee'])
self.assertRoles(support_request, self.user_id, ['Owner'])
def test_OrganisationMember(self):
def test_SourceProject(self):
project = self.addProject()
person = self.makePerson(project, user=1)
compute_node = self.portal.compute_node_module.newContent(
portal_type='Compute Node',
follow_up_value=project)
organisation = self.portal.organisation_module.newContent(
portal_type='Organisation',
reference="TESTO-%s" % self.generateNewId())
self.tic()
self.login(person.getUserId())
compute_node.ComputeNode_createMovement(
destination=person.getRelativeUrl(),
destination_section=organisation.getRelativeUrl())
self.login()
self.tic()
upgrade_decision = self.portal.upgrade_decision_module.newContent(
portal_type='Upgrade Decision',
destination_decision_value=person)
support_request = self.portal.getDefaultModuleValue(self.ticket_portal_type).newContent(
portal_type=self.ticket_portal_type,
source_project_value=project)
support_request.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(support_request, [self.user_id,
'%s_F-PRODAGNT' % project.getReference(),
'%s_F-PRODMAN' % project.getReference()], False)
self.assertRoles(support_request, self.user_id, ['Owner'])
self.assertRoles(support_request, '%s_F-PRODMAN' % project.getReference(), ['Assignor'])
self.assertRoles(support_request, '%s_F-PRODAGNT' % project.getReference(), ['Assignee'])
upgrade_decision.newContent(
portal_type="Upgrade Decision Line",
aggregate=compute_node.getRelativeUrl()
)
upgrade_decision.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(upgrade_decision,
['G-COMPANY', person.getUserId(), self.user_id, organisation.getReference()], False)
self.assertRoles(upgrade_decision, 'G-COMPANY', ['Assignor'])
self.assertRoles(upgrade_decision, person.getUserId(), ['Assignee'])
self.assertRoles(upgrade_decision, self.user_id, ['Owner'])
self.assertRoles(upgrade_decision, organisation.getReference(), ['Assignee'])
def test_OrganisationMember_InstanceTree(self):
def test_DestinationProject(self):
project = self.addProject()
person = self.makePerson(project, user=1)
instance_tree = self.portal.instance_tree_module.newContent(
portal_type='Instance Tree',
reference="INSTTREETEST-%s" % self.generateNewId(),
title="INSTTREETEST-%s" % self.generateNewId(),
destination_section=person.getRelativeUrl(),
follow_up_value=project
)
organisation = self.portal.organisation_module.newContent(
portal_type='Organisation',
reference="TESTO-%s" % self.generateNewId())
self.tic()
self.login(person.getUserId())
instance_tree.InstanceTree_createMovement(
destination=organisation.getRelativeUrl())
self.login()
self.tic()
upgrade_decision = self.portal.upgrade_decision_module.newContent(
portal_type='Upgrade Decision',
destination_decision_value=person)
upgrade_decision.newContent(
portal_type="Upgrade Decision Line",
aggregate=instance_tree.getRelativeUrl()
)
upgrade_decision.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(upgrade_decision,
['G-COMPANY', person.getUserId(), self.user_id, organisation.getReference()], False)
self.assertRoles(upgrade_decision, 'G-COMPANY', ['Assignor'])
self.assertRoles(upgrade_decision, person.getUserId(), ['Assignee'])
self.assertRoles(upgrade_decision, self.user_id, ['Owner'])
self.assertRoles(upgrade_decision, organisation.getReference(), ['Assignee'])
class TestDataStreamModule(TestSlapOSGroupRoleSecurityMixin):
def test_DataStreamModule(self):
module = self.portal.data_stream_module
self.changeOwnership(module)
self.assertSecurityGroup(module,
['G-COMPANY', 'R-COMPUTER', self.user_id],
False)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
self.assertRoles(module, 'R-COMPUTER', ['Auditor', 'Author'])
self.assertRoles(module, self.user_id, ['Owner'])
class TestDataStream(TestSlapOSGroupRoleSecurityMixin):
def test_DataStream(self):
data_stream = self.portal.data_stream_module.newContent(
portal_type='Data Stream')
self.assertSecurityGroup(data_stream,
['G-COMPANY', 'R-COMPUTER', self.user_id],
False)
self.assertRoles(data_stream, 'G-COMPANY', ['Assignor'])
self.assertRoles(data_stream, 'R-COMPUTER', ['Assignor'])
self.assertRoles(data_stream, self.user_id, ['Owner'])
class TestDataIngestionModule(TestSlapOSGroupRoleSecurityMixin):
def test_DataIngestionModule(self):
module = self.portal.data_ingestion_module
self.changeOwnership(module)
self.assertSecurityGroup(module,
['G-COMPANY', 'R-COMPUTER', self.user_id],
False)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
self.assertRoles(module, 'R-COMPUTER', ['Auditor', 'Author'])
self.assertRoles(module, self.user_id, ['Owner'])
class TestDataIngestion(TestSlapOSGroupRoleSecurityMixin):
def test_DataIngestion(self):
data_ingestion = self.portal.data_ingestion_module.newContent(
portal_type='Data Ingestion')
self.assertSecurityGroup(data_ingestion,
['G-COMPANY', 'R-COMPUTER', self.user_id],
False)
self.assertRoles(data_ingestion, 'G-COMPANY', ['Assignor'])
self.assertRoles(data_ingestion, 'R-COMPUTER', ['Assignor'])
self.assertRoles(data_ingestion, self.user_id, ['Owner'])
class TestDataOperationModule(TestSlapOSGroupRoleSecurityMixin):
def test_DataOperationModule(self):
module = self.portal.data_operation_module
self.changeOwnership(module)
self.assertSecurityGroup(module,
['G-COMPANY', 'R-COMPUTER', self.user_id],
False)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
self.assertRoles(module, 'R-COMPUTER', ['Auditor'])
self.assertRoles(module, self.user_id, ['Owner'])
class TestDataOperation(TestSlapOSGroupRoleSecurityMixin):
def test_DataOperation(self):
data_operation = self.portal.data_operation_module.newContent(
portal_type='Data Operation')
self.assertSecurityGroup(data_operation,
['G-COMPANY', 'R-COMPUTER', self.user_id],
False)
self.assertRoles(data_operation, 'G-COMPANY', ['Assignor'])
self.assertRoles(data_operation, 'R-COMPUTER', ['Auditor'])
self.assertRoles(data_operation, self.user_id, ['Owner'])
class TestDataSupplyModule(TestSlapOSGroupRoleSecurityMixin):
def test_DataSupplyModule(self):
module = self.portal.data_supply_module
self.changeOwnership(module)
self.assertSecurityGroup(module,
['G-COMPANY', 'R-COMPUTER', self.user_id],
False)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
self.assertRoles(module, 'R-COMPUTER', ['Auditor'])
self.assertRoles(module, self.user_id, ['Owner'])
class TestDataSupply(TestSlapOSGroupRoleSecurityMixin):
def test_DataSupply(self):
data_supply = self.portal.data_supply_module.newContent(
portal_type='Data Supply')
self.assertSecurityGroup(data_supply,
['G-COMPANY', 'R-COMPUTER', self.user_id],
False)
self.assertRoles(data_supply, 'G-COMPANY', ['Assignor'])
self.assertRoles(data_supply, 'R-COMPUTER', ['Auditor'])
self.assertRoles(data_supply, self.user_id, ['Owner'])
class TestDataMappingModule(TestSlapOSGroupRoleSecurityMixin):
def test_DataMappingModule(self):
module = self.portal.data_mapping_module
self.changeOwnership(module)
self.assertSecurityGroup(module,
['G-COMPANY', self.user_id],
False)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
self.assertRoles(module, self.user_id, ['Owner'])
class TestDataMapping(TestSlapOSGroupRoleSecurityMixin):
def test_DataMapping(self):
data_mapping = self.portal.data_mapping_module.newContent(
portal_type='Data Mapping')
self.assertSecurityGroup(data_mapping,
['G-COMPANY', self.user_id],
False)
self.assertRoles(data_mapping, 'G-COMPANY', ['Assignor'])
self.assertRoles(data_mapping, self.user_id, ['Owner'])
class TestDataTransformationModule(TestSlapOSGroupRoleSecurityMixin):
def test_DataTransformationModule(self):
module = self.portal.data_transformation_module
self.changeOwnership(module)
self.assertSecurityGroup(module,
['G-COMPANY', self.user_id],
False)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
self.assertRoles(module, self.user_id, ['Owner'])
class TestDataTransformation(TestSlapOSGroupRoleSecurityMixin):
def test_DataTransformation(self):
data_transformation = self.portal.data_transformation_module.newContent(
portal_type='Data Transformation')
self.assertSecurityGroup(data_transformation,
['G-COMPANY', self.user_id],
False)
self.assertRoles(data_transformation, 'G-COMPANY', ['Assignor'])
self.assertRoles(data_transformation, self.user_id, ['Owner'])
class TestDataArrayModule(TestSlapOSGroupRoleSecurityMixin):
def test_DataArrayModule(self):
module = self.portal.data_array_module
self.changeOwnership(module)
self.assertSecurityGroup(module,
['G-COMPANY', self.user_id],
False)
self.assertRoles(module, 'G-COMPANY', ['Auditor', 'Author'])
self.assertRoles(module, self.user_id, ['Owner'])
class TestDataArray(TestSlapOSGroupRoleSecurityMixin):
def test_DataArray(self):
data_array = self.portal.data_array_module.newContent(
portal_type='Data Array')
self.assertSecurityGroup(data_array,
['G-COMPANY', self.user_id],
False)
self.assertRoles(data_array, 'G-COMPANY', ['Assignor'])
self.assertRoles(data_array, self.user_id, ['Owner'])
support_request = self.portal.getDefaultModuleValue(self.ticket_portal_type).newContent(
portal_type=self.ticket_portal_type,
destination_project_value=project)
support_request.updateLocalRolesOnSecurityGroups()
self.assertSecurityGroup(support_request, [self.user_id,
'%s_F-PRODAGNT' % project.getReference(),
'%s_F-PRODMAN' % project.getReference()], False)
self.assertRoles(support_request, self.user_id, ['Owner'])
self.assertRoles(support_request, '%s_F-PRODMAN' % project.getReference(), ['Assignor'])
self.assertRoles(support_request, '%s_F-PRODAGNT' % project.getReference(), ['Assignee'])
......@@ -28,7 +28,6 @@ campaign_module
cloud_contract_module
compute_node_module
computer_model_module
computer_module
computer_network_module
consumption_document_module
credential_update_module
......
......@@ -23,7 +23,6 @@ Compute Node Module
Computer Consumption TioXML File
Computer Model
Computer Model Module
Computer Module
Computer Network
Computer Network Module
Consumption Document Module
......
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