Commit 665ab6a5 authored by Romain Courteaud's avatar Romain Courteaud

Fix Slave local roles trigger.

Interaction workflow are required to automate recalculation.
parent 614ac6a5
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
<type>Person</type> <type>Person</type>
<workflow>local_permission_slapos_interaction_workflow</workflow> <workflow>local_permission_slapos_interaction_workflow</workflow>
</chain> </chain>
<chain>
<type>Slave Instance</type>
<workflow>local_permission_slapos_interaction_workflow</workflow>
</chain>
<chain> <chain>
<type>Software Installation</type> <type>Software Installation</type>
<workflow>local_permission_slapos_interaction_workflow</workflow> <workflow>local_permission_slapos_interaction_workflow</workflow>
......
...@@ -216,3 +216,48 @@ class TestSlapOSLocalPermissionSlapOSInteractionWorkflow( ...@@ -216,3 +216,48 @@ class TestSlapOSLocalPermissionSlapOSInteractionWorkflow(
computer.getReference(), hosting_subscription.getReference()], False) computer.getReference(), hosting_subscription.getReference()], False)
self.assertSecurityGroup(partition, [self.user_id, self.assertSecurityGroup(partition, [self.user_id,
hosting_subscription.getReference()], True) hosting_subscription.getReference()], True)
def test_SlaveInstance_setSpecialise(self):
slave_instance = self.portal.software_instance_module.newContent(
portal_type='Slave Instance')
self.assertSecurityGroup(slave_instance, [self.user_id, 'G-COMPANY'],
False)
hosting_subscription = self.portal.hosting_subscription_module.newContent(
portal_type='Hosting Subscription', reference='TESTHS-%s' %
self.generateNewId())
slave_instance.edit(specialise=hosting_subscription.getRelativeUrl())
transaction.commit()
self.assertSecurityGroup(slave_instance, [self.user_id, 'G-COMPANY',
hosting_subscription.getReference()], False)
def test_SlaveInstance_setAggregate(self):
hosting_subscription = self.portal.hosting_subscription_module.newContent(
portal_type='Hosting Subscription', reference='TESTHS-%s' %
self.generateNewId())
software_instance = self.portal.software_instance_module.newContent(
portal_type='Software Instance',
reference='TESTSO-%s' % self.generateNewId(),
specialise=hosting_subscription.getRelativeUrl())
software_instance.validate()
slave_instance = self.portal.software_instance_module.newContent(
portal_type='Slave Instance',
specialise=hosting_subscription.getRelativeUrl())
self.assertSecurityGroup(slave_instance, [self.user_id, 'G-COMPANY',
hosting_subscription.getReference()],
False)
computer = self.portal.computer_module.template_computer\
.Base_createCloneDocument(batch_mode=1)
computer.edit(reference='TESTC-%s' % self.generateNewId())
partition = computer.newContent(portal_type='Computer Partition')
software_instance.edit(aggregate=partition.getRelativeUrl())
self.portal.portal_workflow._jumpToStateFor(partition, 'busy')
self.tic()
slave_instance.edit(aggregate=partition.getRelativeUrl())
self.assertSecurityGroup(slave_instance, [self.user_id, 'G-COMPANY',
software_instance.getReference(), computer.getReference(),
hosting_subscription.getReference()], False)
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
<key> <string>portal_type_filter</string> </key> <key> <string>portal_type_filter</string> </key>
<value> <value>
<list> <list>
<string>Slave Instance</string>
<string>Software Instance</string> <string>Software Instance</string>
</list> </list>
</value> </value>
......
66 67
\ No newline at end of file \ No newline at end of file
...@@ -3,5 +3,6 @@ Computer Network | local_permission_slapos_interaction_workflow ...@@ -3,5 +3,6 @@ Computer Network | local_permission_slapos_interaction_workflow
Computer | local_permission_slapos_interaction_workflow Computer | local_permission_slapos_interaction_workflow
Hosting Subscription | local_permission_slapos_interaction_workflow Hosting Subscription | local_permission_slapos_interaction_workflow
Person | local_permission_slapos_interaction_workflow Person | local_permission_slapos_interaction_workflow
Slave Instance | local_permission_slapos_interaction_workflow
Software Installation | local_permission_slapos_interaction_workflow Software Installation | local_permission_slapos_interaction_workflow
Software Instance | local_permission_slapos_interaction_workflow Software Instance | local_permission_slapos_interaction_workflow
\ No newline at end of file
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