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
4093d3e5
Commit
4093d3e5
authored
Jan 10, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: project needed to create person
parent
b1e58f78
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
39 deletions
+66
-39
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
...l_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
+66
-39
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
View file @
4093d3e5
...
...
@@ -112,7 +112,8 @@ class TestComputeNode(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
compute_node
,
compute_node
.
getUserId
(),
[
'Assignor'
])
def
test_ProjectMember
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
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
())
...
...
@@ -137,7 +138,8 @@ class TestComputeNode(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
compute_node
,
project
.
getReference
(),
[
'Assignee'
])
def
test_OrganisationMember
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
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
())
...
...
@@ -278,7 +280,8 @@ class TestComputeNodeModule(TestSlapOSGroupRoleSecurityMixin):
class
TestComputerNetwork
(
TestSlapOSGroupRoleSecurityMixin
):
def
test_ProjectMember
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
user
=
1
)
network
=
self
.
portal
.
computer_network_module
.
newContent
(
portal_type
=
'Computer Network'
,
source_administration
=
person
.
getRelativeUrl
())
...
...
@@ -303,7 +306,8 @@ class TestComputerNetwork(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
network
,
project
.
getReference
(),
[
'Assignee'
])
def
test_OrganisationMember
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
user
=
1
)
network
=
self
.
portal
.
computer_network_module
.
newContent
(
portal_type
=
'Computer Network'
,
source_administration
=
person
.
getRelativeUrl
())
...
...
@@ -461,7 +465,8 @@ class TestInstanceTree(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
subscription
,
'G-COMPANY'
,
[
'Assignor'
])
def
test_ProjectMember
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
user
=
1
)
reference
=
'TESTHS-%s'
%
self
.
generateNewId
()
subscription
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
'Instance Tree'
,
reference
=
reference
,
...
...
@@ -488,7 +493,8 @@ class TestInstanceTree(TestSlapOSGroupRoleSecurityMixin):
def
test_OrganisationMember
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
user
=
1
)
reference
=
'TESTHS-%s'
%
self
.
generateNewId
()
subscription
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
'Instance Tree'
,
reference
=
reference
,
...
...
@@ -603,7 +609,8 @@ class TestProjectModule(TestSlapOSGroupRoleSecurityMixin):
class
TestProject
(
TestSlapOSGroupRoleSecurityMixin
):
def
test_with_user
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
user
=
1
)
project
=
self
.
portal
.
project_module
.
newContent
(
portal_type
=
'Project'
,
destination_decision_value
=
person
)
...
...
@@ -818,7 +825,8 @@ class TestSlaveInstance(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
instance
,
self
.
user_id
,
[
'Owner'
])
def
test_ProjectMember
(
self
):
customer
=
self
.
makePerson
(
user
=
1
)
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'
,
...
...
@@ -848,7 +856,8 @@ class TestSlaveInstance(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
instance
,
project
.
getReference
(),
[
'Assignee'
])
def
test_OrganisationMember
(
self
):
customer
=
self
.
makePerson
(
user
=
1
)
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'
,
...
...
@@ -936,7 +945,8 @@ class TestSoftwareInstallation(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
installation
,
self
.
user_id
,
[
'Owner'
])
def
test_ProjectMember
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
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
)
...
...
@@ -965,7 +975,8 @@ class TestSoftwareInstallation(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
installation
,
project
.
getReference
(),
[
'Assignee'
])
def
test_OrganisationMember
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
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
)
...
...
@@ -1055,7 +1066,8 @@ class TestSoftwareInstance(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
instance
,
self
.
user_id
,
[
'Owner'
])
def
test_ProjectMember
(
self
):
customer
=
self
.
makePerson
(
user
=
1
)
project
=
self
.
addProject
()
customer
=
self
.
makePerson
(
project
,
user
=
1
)
subscription_reference
=
'TESTHS-%s '
%
self
.
generateNewId
()
instance_tree
=
self
.
portal
.
instance_tree_module
.
newContent
(
...
...
@@ -1086,7 +1098,8 @@ class TestSoftwareInstance(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
instance
,
project
.
getReference
(),
[
'Assignee'
])
def
test_OrganisationMember
(
self
):
customer
=
self
.
makePerson
(
user
=
1
)
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'
,
...
...
@@ -1330,8 +1343,8 @@ class TestPaymentTransaction(TestSlapOSGroupRoleSecurityMixin):
product
.
updateLocalRolesOnSecurityGroups
()
shadow_user_id
=
'SHADOW-%s'
%
person
.
getUserId
()
self
.
assertSecurityGroup
(
product
,
[
'
G-COMPANY
'
,
self
.
user_id
,
person
.
getUserId
(),
shadow_user_id
],
False
)
self
.
assertRoles
(
product
,
'
G-COMPANY
'
,
[
'Assignor'
])
[
'
F-IS*
'
,
self
.
user_id
,
person
.
getUserId
(),
shadow_user_id
],
False
)
self
.
assertRoles
(
product
,
'
F-IS*
'
,
[
'Assignor'
])
self
.
assertRoles
(
product
,
shadow_user_id
,
[
'Auditor'
])
self
.
assertRoles
(
product
,
person
.
getUserId
(),
[
'Auditor'
])
self
.
assertRoles
(
product
,
self
.
user_id
,
[
'Owner'
])
...
...
@@ -1708,7 +1721,8 @@ class TestMailMessage(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
product
,
self
.
user_id
,
[
'Owner'
])
def
test_ProjectMember
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
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
())
...
...
@@ -1745,8 +1759,8 @@ class TestMailMessage(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
event
,
self
.
user_id
,
[
'Owner'
])
def
test_ProjectMember_InstanceTreeRequest
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
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
(),
...
...
@@ -1785,7 +1799,8 @@ class TestMailMessage(TestSlapOSGroupRoleSecurityMixin):
def
test_OrganisationMember
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
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
())
...
...
@@ -1823,7 +1838,8 @@ class TestMailMessage(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
event
,
self
.
user_id
,
[
'Owner'
])
def
test_OrganisationMember_InstanceTree
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
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
(),
...
...
@@ -1973,7 +1989,8 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
[
'Access contents information'
,
'View'
])
def
test_ProjectMember
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
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
())
...
...
@@ -2002,7 +2019,8 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
support_request
,
project
.
getReference
(),
[
'Auditor'
])
def
test_ProjectMember_InstanceTree
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
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
(),
...
...
@@ -2033,7 +2051,8 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
def
test_OrganisationMember
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
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
())
...
...
@@ -2063,7 +2082,8 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
support_request
,
organisation
.
getReference
(),
[
'Auditor'
])
def
test_OrganisationMember_InstanceTree
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
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
(),
...
...
@@ -2172,8 +2192,8 @@ class TestPayzenEvent(TestSlapOSGroupRoleSecurityMixin):
portal_type
=
'Payzen Event'
)
event
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
event
,
[
'
G-COMPANY
'
,
self
.
user_id
],
False
)
self
.
assertRoles
(
event
,
'
G-COMPANY
'
,
[
'Auditor'
])
[
'
F-IS*
'
,
self
.
user_id
],
False
)
self
.
assertRoles
(
event
,
'
F-IS*
'
,
[
'Auditor'
])
self
.
assertRoles
(
event
,
self
.
user_id
,
[
'Owner'
])
def
test_ShadowUser
(
self
):
...
...
@@ -2188,8 +2208,8 @@ class TestPayzenEvent(TestSlapOSGroupRoleSecurityMixin):
event
.
updateLocalRolesOnSecurityGroups
()
shadow_user_id
=
'SHADOW-%s'
%
person
.
getUserId
()
self
.
assertSecurityGroup
(
event
,
[
'
G-COMPANY
'
,
self
.
user_id
,
shadow_user_id
],
False
)
self
.
assertRoles
(
event
,
'
G-COMPANY
'
,
[
'Auditor'
])
[
'
F-IS*
'
,
self
.
user_id
,
shadow_user_id
],
False
)
self
.
assertRoles
(
event
,
'
F-IS*
'
,
[
'Auditor'
])
self
.
assertRoles
(
event
,
shadow_user_id
,
[
'Assignee'
])
self
.
assertRoles
(
event
,
self
.
user_id
,
[
'Owner'
])
...
...
@@ -2199,8 +2219,8 @@ class TestWechatEvent(TestSlapOSGroupRoleSecurityMixin):
portal_type
=
'Wechat Event'
)
event
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
event
,
[
'
G-COMPANY
'
,
self
.
user_id
],
False
)
self
.
assertRoles
(
event
,
'
G-COMPANY
'
,
[
'Auditor'
])
[
'
F-IS*
'
,
self
.
user_id
],
False
)
self
.
assertRoles
(
event
,
'
F-IS*
'
,
[
'Auditor'
])
self
.
assertRoles
(
event
,
self
.
user_id
,
[
'Owner'
])
def
test_ShadowUser
(
self
):
...
...
@@ -2215,8 +2235,8 @@ class TestWechatEvent(TestSlapOSGroupRoleSecurityMixin):
event
.
updateLocalRolesOnSecurityGroups
()
shadow_user_id
=
'SHADOW-%s'
%
person
.
getUserId
()
self
.
assertSecurityGroup
(
event
,
[
'
G-COMPANY
'
,
self
.
user_id
,
shadow_user_id
],
False
)
self
.
assertRoles
(
event
,
'
G-COMPANY
'
,
[
'Auditor'
])
[
'
F-IS*
'
,
self
.
user_id
,
shadow_user_id
],
False
)
self
.
assertRoles
(
event
,
'
F-IS*
'
,
[
'Auditor'
])
self
.
assertRoles
(
event
,
shadow_user_id
,
[
'Assignee'
])
self
.
assertRoles
(
event
,
self
.
user_id
,
[
'Owner'
])
...
...
@@ -2494,7 +2514,8 @@ class TestUpgradeDecision(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
upgrade_decision
,
self
.
user_id
,
[
'Owner'
])
def
test_ProjectMember
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
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
())
...
...
@@ -2526,12 +2547,14 @@ class TestUpgradeDecision(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
upgrade_decision
,
project
.
getReference
(),
[
'Assignee'
])
def
test_ProjectMember_InstanceTree
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
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
())
destination_section
=
person
.
getRelativeUrl
(),
follow_up_value
=
project
)
project
=
self
.
portal
.
project_module
.
newContent
(
portal_type
=
'Project'
)
...
...
@@ -2559,10 +2582,11 @@ class TestUpgradeDecision(TestSlapOSGroupRoleSecurityMixin):
def
test_OrganisationMember
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
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
()
)
follow_up_value
=
project
)
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
,
reference
=
"TESTO-%s"
%
self
.
generateNewId
())
...
...
@@ -2592,12 +2616,15 @@ class TestUpgradeDecision(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
upgrade_decision
,
organisation
.
getReference
(),
[
'Assignee'
])
def
test_OrganisationMember_InstanceTree
(
self
):
person
=
self
.
makePerson
(
user
=
1
)
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
())
destination_section
=
person
.
getRelativeUrl
(),
follow_up_value
=
project
)
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
,
reference
=
"TESTO-%s"
%
self
.
generateNewId
())
...
...
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