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
1
Merge Requests
1
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
Romain Courteaud
slapos.core
Commits
9fec1c2a
Commit
9fec1c2a
authored
Jan 13, 2023
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: test Software Installation local roles
parent
8e1e9835
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
78 deletions
+16
-78
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
...l_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
+16
-78
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
View file @
9fec1c2a
...
...
@@ -662,14 +662,12 @@ class TestSlaveInstance(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
instance
,
self
.
user_id
,
[
'Owner'
])
class
TestSoftwareInstallation
(
TestSlapOSGroupRoleSecurityMixin
):
def
test_
GroupCompany
(
self
):
def
test_
default
(
self
):
installation
=
self
.
portal
.
software_installation_module
.
newContent
(
portal_type
=
'Software Installation'
)
installation
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
installation
,
[
self
.
user_id
,
'G-COMPANY'
],
False
)
self
.
assertRoles
(
installation
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertSecurityGroup
(
installation
,
[
self
.
user_id
],
False
)
self
.
assertRoles
(
installation
,
self
.
user_id
,
[
'Owner'
])
def
test_ComputeNode
(
self
):
...
...
@@ -684,98 +682,38 @@ class TestSoftwareInstallation(TestSlapOSGroupRoleSecurityMixin):
installation
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
installation
,
[
self
.
user_id
,
'G-COMPANY'
,
compute_node
.
getUserId
()],
False
)
self
.
assertRoles
(
installation
,
'G-COMPANY'
,
[
'Assignor'
])
compute_node
.
getUserId
()],
False
)
self
.
assertRoles
(
installation
,
compute_node
.
getUserId
(),
[
'Assignor'
])
self
.
assertRoles
(
installation
,
self
.
user_id
,
[
'Owner'
])
def
test_ProjectMember
(
self
):
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
user
=
1
)
compute_node_reference
=
'TESTCOMP-%s'
%
self
.
generateNewId
()
compute_node
=
self
.
portal
.
compute_node_module
.
template_compute_node
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
compute_node
.
edit
(
reference
=
compute_node_reference
,
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
()
installation
=
self
.
portal
.
software_installation_module
.
newContent
(
portal_type
=
'Software Installation'
,
aggregate
=
compute_node
.
getRelativeUrl
())
installation
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
installation
,
[
self
.
user_id
,
'G-COMPANY'
,
compute_node
.
getUserId
(),
project
.
getReference
()],
False
)
self
.
assertRoles
(
installation
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
installation
,
compute_node
.
getUserId
(),
[
'Assignor'
])
self
.
assertRoles
(
installation
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
installation
,
project
.
getReference
(),
[
'Assignee'
])
def
test_OrganisationMember
(
self
):
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
user
=
1
)
compute_node_reference
=
'TESTCOMP-%s'
%
self
.
generateNewId
()
compute_node
=
self
.
portal
.
compute_node_module
.
template_compute_node
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
compute_node
.
edit
(
reference
=
compute_node_reference
,
source_administration
=
person
.
getRelativeUrl
())
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
()
installation
=
self
.
portal
.
software_installation_module
.
newContent
(
portal_type
=
'Software Installation'
,
aggregate
=
compute_node
.
getRelativeUrl
()
)
follow_up_value
=
project
)
installation
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
installation
,
[
self
.
user_id
,
'G-COMPANY'
,
compute_node
.
getUserId
(),
organisation
.
getReference
()],
False
)
self
.
assertRoles
(
installation
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
installation
,
compute_node
.
getUserId
(),
[
'Assignor'
])
self
.
assertSecurityGroup
(
installation
,
[
self
.
user_id
,
'%s_F-PRODAGNT'
%
project
.
getReference
(),
'%s_F-PRODMAN'
%
project
.
getReference
(),
'%s_F-CUSTOMER'
%
project
.
getReference
(),
],
False
)
self
.
assertRoles
(
installation
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
installation
,
organisation
.
getReference
(),
[
'Assignee'
])
def
test_ProviderOfTheInstallation
(
self
):
provider_reference
=
'TESTPERSON-%s'
%
self
.
generateNewId
()
provider
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
reference
=
provider_reference
)
installation
=
self
.
portal
.
software_installation_module
.
newContent
(
portal_type
=
'Software Installation'
,
destination_section
=
provider
.
getRelativeUrl
())
installation
.
updateLocalRolesOnSecurityGroups
()
self
.
assertRoles
(
installation
,
'%s_F-PRODAGNT'
%
project
.
getReference
(),
[
'Assignee'
])
self
.
assertRoles
(
installation
,
'%s_F-PRODMAN'
%
project
.
getReference
(),
[
'Assignor'
])
self
.
assertRoles
(
installation
,
'%s_F-CUSTOMER'
%
project
.
getReference
(),
[
'Auditor'
])
self
.
assertSecurityGroup
(
installation
,
[
self
.
user_id
,
'G-COMPANY'
,
provider
.
getUserId
()],
False
)
self
.
assertRoles
(
installation
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
installation
,
provider
.
getUserId
(),
[
'Assignee'
])
self
.
assertRoles
(
installation
,
self
.
user_id
,
[
'Owner'
])
class
TestSoftwareInstallationModule
(
TestSlapOSGroupRoleSecurityMixin
):
def
test
(
self
):
module
=
self
.
portal
.
software_installation_module
self
.
changeOwnership
(
module
)
self
.
assertSecurityGroup
(
module
,
[
'
G-COMPANY'
,
'R-MEMB
ER'
,
'R-COMPUTER'
,
self
.
user_id
],
False
)
[
'
F-PRODUCTION*'
,
'F-CUSTOM
ER'
,
'R-COMPUTER'
,
self
.
user_id
],
False
)
self
.
assertRoles
(
module
,
'R-COMPUTER'
,
[
'Auditor'
])
self
.
assertRoles
(
module
,
'
R-MEMBER'
,
[
'Auditor'
,
'Auth
or'
])
self
.
assertRoles
(
module
,
'
G-COMPANY
'
,
[
'Auditor'
,
'Author'
])
self
.
assertRoles
(
module
,
'
F-CUSTOMER'
,
[
'Audit
or'
])
self
.
assertRoles
(
module
,
'
F-PRODUCTION*
'
,
[
'Auditor'
,
'Author'
])
self
.
assertRoles
(
module
,
self
.
user_id
,
[
'Owner'
])
class
TestSoftwareInstance
(
TestSlapOSGroupRoleSecurityMixin
):
...
...
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