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
Titouan Soulard
slapos.core
Commits
3f662441
Commit
3f662441
authored
Jan 13, 2023
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: test Software Instance local roles
parent
650487fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
66 deletions
+17
-66
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
...l_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
+17
-66
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
View file @
3f662441
...
...
@@ -982,13 +982,12 @@ class TestSoftwareInstallationModule(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
module
,
self
.
user_id
,
[
'Owner'
])
class
TestSoftwareInstance
(
TestSlapOSGroupRoleSecurityMixin
):
def
test_
GroupCompany
(
self
):
def
test_
default
(
self
):
instance
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
'Software Instance'
)
instance
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
instance
,
[
'G-COMPANY'
,
self
.
user_id
],
False
)
self
.
assertRoles
(
instance
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertSecurityGroup
(
instance
,
[
self
.
user_id
],
False
)
self
.
assertRoles
(
instance
,
self
.
user_id
,
[
'Owner'
])
def
test_CustomerOfTheInstance
(
self
):
...
...
@@ -1006,76 +1005,29 @@ class TestSoftwareInstance(TestSlapOSGroupRoleSecurityMixin):
portal_type
=
'Software Instance'
,
specialise
=
subscription
.
getRelativeUrl
())
instance
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
instance
,
[
'G-COMPANY'
,
customer
.
getUserId
(),
self
.
assertSecurityGroup
(
instance
,
[
customer
.
getUserId
(),
subscription_reference
,
self
.
user_id
],
False
)
self
.
assertRoles
(
instance
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
instance
,
customer
.
getUserId
(),
[
'Assignee'
])
self
.
assertRoles
(
instance
,
subscription_reference
,
[
'Assignee'
])
self
.
assertRoles
(
instance
,
self
.
user_id
,
[
'Owner'
])
def
test_ProjectMember
(
self
):
project
=
self
.
addProject
()
customer
=
self
.
makePerson
(
project
,
user
=
1
)
subscription_reference
=
'TESTHS-%s '
%
self
.
generateNewId
()
instance_tree
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
'Instance Tree'
,
title
=
"INSTTREETEST-%s"
%
self
.
generateNewId
(),
reference
=
subscription_reference
,
destination_section
=
customer
.
getRelativeUrl
())
project
=
self
.
portal
.
project_module
.
newContent
(
portal_type
=
'Project'
)
self
.
tic
()
self
.
login
(
customer
.
getUserId
())
instance_tree
.
InstanceTree_createMovement
(
destination_project
=
project
.
getRelativeUrl
())
self
.
login
()
self
.
tic
()
instance
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
'Software Instance'
,
specialise
=
instance_tree
.
getRelativeUrl
())
instance
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
instance
,
[
'G-COMPANY'
,
customer
.
getUserId
(),
subscription_reference
,
self
.
user_id
,
project
.
getReference
()],
False
)
self
.
assertRoles
(
instance
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
instance
,
customer
.
getUserId
(),
[
'Assignee'
])
self
.
assertRoles
(
instance
,
subscription_reference
,
[
'Assignee'
])
self
.
assertRoles
(
instance
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
instance
,
project
.
getReference
(),
[
'Assignee'
])
def
test_OrganisationMember
(
self
):
project
=
self
.
addProject
()
customer
=
self
.
makePerson
(
project
,
user
=
1
)
subscription_reference
=
'TESTHS-%s '
%
self
.
generateNewId
()
instance_tree
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
'Instance Tree'
,
title
=
"INSTTREETEST-%s"
%
self
.
generateNewId
(),
reference
=
subscription_reference
,
destination_section
=
customer
.
getRelativeUrl
())
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
,
reference
=
"TESTO-%s"
%
self
.
generateNewId
())
self
.
tic
()
self
.
login
(
customer
.
getUserId
())
instance_tree
.
InstanceTree_createMovement
(
destination
=
organisation
.
getRelativeUrl
())
self
.
login
()
self
.
tic
()
instance
=
self
.
portal
.
software_instance_module
.
newContent
(
portal_type
=
'Software Instance'
,
specialise
=
instance_tree
.
getRelativeUrl
())
portal_type
=
'Software Instance'
,
follow_up_value
=
project
)
instance
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
instance
,
[
'G-COMPANY'
,
customer
.
getUserId
(),
subscription_reference
,
self
.
user_id
,
organisation
.
getReference
()],
False
)
self
.
assertRoles
(
instance
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
instance
,
customer
.
getUserId
(),
[
'Assignee'
])
self
.
assertRoles
(
instance
,
subscription_reference
,
[
'Assignee'
]
)
self
.
assertSecurityGroup
(
instance
,
[
self
.
user_id
,
'%s_F-PRODAGNT'
%
project
.
getReference
(),
'%s_F-PRODMAN'
%
project
.
getReference
(),
],
False
)
self
.
assertRoles
(
instance
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
instance
,
organisation
.
getReference
(),
[
'Assignee'
])
self
.
assertRoles
(
instance
,
'%s_F-PRODAGNT'
%
project
.
getReference
(),
[
'Assignee'
])
self
.
assertRoles
(
instance
,
'%s_F-PRODMAN'
%
project
.
getReference
(),
[
'Assignor'
])
def
test_ComputeNode
(
self
):
compute_node_reference
=
'TESTCOMP-%s'
%
self
.
generateNewId
()
...
...
@@ -1090,9 +1042,8 @@ class TestSoftwareInstance(TestSlapOSGroupRoleSecurityMixin):
portal_type
=
'Software Instance'
,
aggregate
=
partition
.
getRelativeUrl
())
instance
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
instance
,
[
'G-COMPANY'
,
compute_node
.
getUserId
(),
self
.
assertSecurityGroup
(
instance
,
[
compute_node
.
getUserId
(),
self
.
user_id
],
False
)
self
.
assertRoles
(
instance
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
instance
,
compute_node
.
getUserId
(),
[
'Assignor'
])
self
.
assertRoles
(
instance
,
self
.
user_id
,
[
'Owner'
])
...
...
@@ -1101,9 +1052,9 @@ class TestSoftwareInstanceModule(TestSlapOSGroupRoleSecurityMixin):
module
=
self
.
portal
.
software_instance_module
self
.
changeOwnership
(
module
)
self
.
assertSecurityGroup
(
module
,
[
'
G-COMPANY'
,
'R-COMPUTER'
,
'R-INSTANCE'
,
'R-MEMB
ER'
,
self
.
user_id
],
False
)
self
.
assertRoles
(
module
,
'
R-MEMB
ER'
,
[
'Auditor'
,
'Author'
])
self
.
assertRoles
(
module
,
'
G-COMPANY'
,
[
'Auditor'
,
'Auth
or'
])
[
'
F-PRODUCTION*'
,
'R-COMPUTER'
,
'R-INSTANCE'
,
'F-CUSTOM
ER'
,
self
.
user_id
],
False
)
self
.
assertRoles
(
module
,
'
F-CUSTOM
ER'
,
[
'Auditor'
,
'Author'
])
self
.
assertRoles
(
module
,
'
F-PRODUCTION*'
,
[
'Audit
or'
])
self
.
assertRoles
(
module
,
'R-COMPUTER'
,
[
'Auditor'
])
self
.
assertRoles
(
module
,
'R-INSTANCE'
,
[
'Auditor'
,
'Author'
])
self
.
assertRoles
(
module
,
self
.
user_id
,
[
'Owner'
])
...
...
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