Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Paul Graydon
slapos.core
Commits
3905a253
Commit
3905a253
authored
Nov 07, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test role generation up to Computer Partition.
parent
76581c90
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
118 additions
and
1 deletion
+118
-1
master/bt5/slapos_erp5/TestTemplateItem/testSlapOSGroupRoleSecurity.py
...apos_erp5/TestTemplateItem/testSlapOSGroupRoleSecurity.py
+117
-0
master/bt5/slapos_erp5/bt/revision
master/bt5/slapos_erp5/bt/revision
+1
-1
No files found.
master/bt5/slapos_erp5/TestTemplateItem/testSlapOSGroupRoleSecurity.py
View file @
3905a253
...
...
@@ -114,3 +114,120 @@ class TestComputer(TestSlapOSGroupRoleSecurityMixin):
[
self
.
user_id
,
'G-COMPANY'
,
reference
],
False
)
self
.
assertRoles
(
computer
,
reference
,
[
'Assignor'
])
class
TestComputerModel
(
TestSlapOSGroupRoleSecurityMixin
):
def
test_GroupCompany
(
self
):
model
=
self
.
portal
.
computer_model_module
.
newContent
(
portal_type
=
'Computer Model'
)
model
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
model
,
[
'G-COMPANY'
,
self
.
user_id
],
False
)
self
.
assertRoles
(
model
,
'G-COMPANY'
,
[
'Assignor'
])
def
test_ComputerAgent
(
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
,
reference
],
False
)
self
.
assertRoles
(
model
,
reference
,
[
'Assignee'
])
class
TestComputerModelModule
(
TestSlapOSGroupRoleSecurityMixin
):
def
test
(
self
):
module
=
self
.
portal
.
computer_model_module
self
.
assertSecurityGroup
(
module
,
[
'R-MEMBER'
,
'zope'
],
False
)
self
.
assertRoles
(
module
,
'R-MEMBER'
,
[
'Auditor'
,
'Author'
])
class
TestComputerModule
(
TestSlapOSGroupRoleSecurityMixin
):
def
test
(
self
):
module
=
self
.
portal
.
computer_module
self
.
assertSecurityGroup
(
module
,
[
'R-COMPUTER'
,
'R-MEMBER'
,
'R-SHADOW-PERSON'
,
'zope'
],
False
)
self
.
assertRoles
(
module
,
'R-MEMBER'
,
[
'Auditor'
,
'Author'
])
self
.
assertRoles
(
module
,
'R-COMPUTER'
,
[
'Auditor'
])
self
.
assertRoles
(
module
,
'R-SHADOW-PERSON'
,
[
'Auditor'
])
class
TestComputerNetwork
(
TestSlapOSGroupRoleSecurityMixin
):
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'
])
test_PersonShadow
=
test_GroupCompany
def
test_ComputerAgent
(
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
,
reference
],
False
)
self
.
assertRoles
(
network
,
reference
,
[
'Assignee'
])
class
TestComputerNetworkModule
(
TestSlapOSGroupRoleSecurityMixin
):
def
test
(
self
):
module
=
self
.
portal
.
computer_network_module
self
.
assertSecurityGroup
(
module
,
[
'R-MEMBER'
,
'R-SHADOW-PERSON'
,
'zope'
],
False
)
self
.
assertRoles
(
module
,
'R-MEMBER'
,
[
'Auditor'
,
'Author'
])
self
.
assertRoles
(
module
,
'R-SHADOW-PERSON'
,
[
'Auditor'
])
class
TestComputerPartition
(
TestSlapOSGroupRoleSecurityMixin
):
def
test_CustomerOfThePartition
(
self
):
partition
=
self
.
portal
.
computer_module
.
newContent
(
portal_type
=
'Computer'
).
newContent
(
portal_type
=
'Computer Partition'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
partition
,
'busy'
)
partition
.
recursiveImmediateReindexObject
()
instance_customer_reference
=
'TESTPERSON-%s'
%
self
.
generateNewId
()
slave_customer_reference
=
'TESTPERSON-%s'
%
self
.
generateNewId
()
instance_customer
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
reference
=
instance_customer_reference
)
slave_customer
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
reference
=
slave_customer_reference
)
instance_subscription_reference
=
'TESTHS-%s'
%
self
.
generateNewId
()
instance_subscription
=
self
.
portal
.
hosting_subscription_module
\
.
template_hosting_subscription
.
Base_createCloneDocument
(
batch_mode
=
1
)
instance_subscription
.
edit
(
destination_section
=
instance_customer
.
getRelativeUrl
(),
reference
=
instance_subscription_reference
)
instance
=
self
.
portal
.
software_instance_module
.
template_software_instance
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
instance
.
edit
(
specialise
=
instance_subscription
.
getRelativeUrl
(),
aggregate
=
partition
.
getRelativeUrl
())
instance
.
validate
()
instance
.
recursiveImmediateReindexObject
()
slave_subscription
=
self
.
portal
.
hosting_subscription_module
\
.
template_hosting_subscription
.
Base_createCloneDocument
(
batch_mode
=
1
)
slave_subscription
.
edit
(
destination_section
=
slave_customer
.
getRelativeUrl
())
slave
=
self
.
portal
.
software_instance_module
.
template_slave_instance
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
slave
.
validate
()
slave
.
edit
(
specialise
=
slave_subscription
.
getRelativeUrl
(),
aggregate
=
partition
.
getRelativeUrl
())
slave
.
recursiveImmediateReindexObject
()
partition
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
partition
,
[
self
.
user_id
,
instance_customer_reference
,
slave_customer_reference
,
instance_subscription_reference
],
True
)
self
.
assertRoles
(
partition
,
instance_customer_reference
,
[
'Auditor'
])
self
.
assertRoles
(
partition
,
slave_customer_reference
,
[
'Auditor'
])
self
.
assertRoles
(
partition
,
instance_subscription_reference
,
[
'Auditor'
])
test_SoftwareInstanceGroupRelatedToComputerPartition
=
\
test_CustomerOfThePartition
master/bt5/slapos_erp5/bt/revision
View file @
3905a253
38
\ No newline at end of file
39
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment