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
2d5ce56e
Commit
2d5ce56e
authored
Jan 13, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: test Event local roles
parent
9c9b7298
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
146 deletions
+18
-146
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
...l_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
+18
-146
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
View file @
2d5ce56e
...
...
@@ -1594,13 +1594,12 @@ class TestEventModule(TestSlapOSGroupRoleSecurityMixin):
class
TestMailMessage
(
TestSlapOSGroupRoleSecurityMixin
):
event_portal_type
=
'Mail Message'
def
test_
GroupCompany
(
self
):
def
test_
default
(
self
):
product
=
self
.
portal
.
event_module
.
newContent
(
portal_type
=
self
.
event_portal_type
)
product
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
product
,
[
'G-COMPANY'
,
self
.
user_id
],
False
)
self
.
assertRoles
(
product
,
'G-COMPANY'
,
[
'Assignor'
])
[
self
.
user_id
],
False
)
self
.
assertRoles
(
product
,
self
.
user_id
,
[
'Owner'
])
def
test_SourceCustomer
(
self
):
...
...
@@ -1613,8 +1612,7 @@ class TestMailMessage(TestSlapOSGroupRoleSecurityMixin):
)
product
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
product
,
[
'G-COMPANY'
,
person
.
getUserId
(),
self
.
user_id
],
False
)
self
.
assertRoles
(
product
,
'G-COMPANY'
,
[
'Assignor'
])
[
person
.
getUserId
(),
self
.
user_id
],
False
)
self
.
assertRoles
(
product
,
person
.
getUserId
(),
[
'Auditor'
])
self
.
assertRoles
(
product
,
self
.
user_id
,
[
'Owner'
])
...
...
@@ -1628,167 +1626,41 @@ class TestMailMessage(TestSlapOSGroupRoleSecurityMixin):
)
product
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
product
,
[
'G-COMPANY'
,
person
.
getUserId
(),
self
.
user_id
],
False
)
self
.
assertRoles
(
product
,
'G-COMPANY'
,
[
'Assignor'
])
[
person
.
getUserId
(),
self
.
user_id
],
False
)
self
.
assertRoles
(
product
,
person
.
getUserId
(),
[
'Auditor'
])
self
.
assertRoles
(
product
,
self
.
user_id
,
[
'Owner'
])
def
test_
ProjectMember
(
self
):
def
test_
SourceProject
(
self
):
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
())
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
()
support_request
=
self
.
portal
.
support_request_module
.
newContent
(
portal_type
=
'Support Request'
,
destination_decision_value
=
person
,
aggregate
=
compute_node
.
getRelativeUrl
()
)
event
=
self
.
portal
.
event_module
.
newContent
(
portal_type
=
self
.
event_portal_type
,
destination_value
=
person
,
follow_up
=
support_request
.
getRelativeUrl
()
source_project_value
=
project
)
event
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
event
,
[
'G-COMPANY'
,
person
.
getUserId
(),
self
.
user_id
,
project
.
getReference
()],
False
)
self
.
assertRoles
(
event
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
event
,
person
.
getUserId
(),
[
'Auditor'
])
self
.
assertRoles
(
event
,
project
.
getReference
(),
[
'Auditor'
])
self
.
assertRoles
(
event
,
self
.
user_id
,
[
'Owner'
])
def
test_ProjectMember_InstanceTreeRequest
(
self
):
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
())
project
=
self
.
portal
.
project_module
.
newContent
(
portal_type
=
'Project'
)
self
.
tic
()
self
.
login
(
person
.
getUserId
())
instance_tree
.
InstanceTree_createMovement
(
destination_project
=
project
.
getRelativeUrl
())
self
.
login
()
self
.
tic
()
support_request
=
self
.
portal
.
support_request_module
.
newContent
(
portal_type
=
'Support Request'
,
destination_decision_value
=
person
,
aggregate
=
instance_tree
.
getRelativeUrl
()
)
event
=
self
.
portal
.
event_module
.
newContent
(
portal_type
=
self
.
event_portal_type
,
destination_value
=
person
,
follow_up
=
support_request
.
getRelativeUrl
()
)
event
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
event
,
[
'G-COMPANY'
,
person
.
getUserId
(),
self
.
user_id
,
project
.
getReference
()],
False
)
self
.
assertRoles
(
event
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
event
,
person
.
getUserId
(),
[
'Auditor'
])
self
.
assertRoles
(
event
,
project
.
getReference
(),
[
'Auditor'
])
self
.
assertSecurityGroup
(
event
,
[
self
.
user_id
,
'%s_F-PRODAGNT'
%
project
.
getReference
(),
'%s_F-PRODMAN'
%
project
.
getReference
()],
False
)
self
.
assertRoles
(
event
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
event
,
'%s_F-PRODMAN'
%
project
.
getReference
(),
[
'Assignor'
])
self
.
assertRoles
(
event
,
'%s_F-PRODAGNT'
%
project
.
getReference
(),
[
'Assignee'
])
def
test_OrganisationMember
(
self
):
def
test_DestinationProject
(
self
):
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
())
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
()
support_request
=
self
.
portal
.
support_request_module
.
newContent
(
portal_type
=
'Support Request'
,
destination_decision_value
=
person
,
aggregate
=
compute_node
.
getRelativeUrl
()
)
event
=
self
.
portal
.
event_module
.
newContent
(
portal_type
=
self
.
event_portal_type
,
destination_value
=
person
,
follow_up
=
support_request
.
getRelativeUrl
()
destination_project_value
=
project
)
event
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
event
,
[
'G-COMPANY'
,
person
.
getUserId
(),
self
.
user_id
,
organisation
.
getReference
()],
False
)
self
.
assertRoles
(
event
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
event
,
person
.
getUserId
(),
[
'Auditor'
])
self
.
assertRoles
(
event
,
organisation
.
getReference
(),
[
'Auditor'
])
self
.
assertRoles
(
event
,
self
.
user_id
,
[
'Owner'
])
def
test_OrganisationMember_InstanceTree
(
self
):
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
())
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
,
reference
=
"TESTO-%s"
%
self
.
generateNewId
())
self
.
tic
()
self
.
login
(
person
.
getUserId
())
instance_tree
.
InstanceTree_createMovement
(
destination
=
organisation
.
getRelativeUrl
())
self
.
login
()
self
.
tic
()
support_request
=
self
.
portal
.
support_request_module
.
newContent
(
portal_type
=
'Support Request'
,
destination_decision_value
=
person
,
aggregate
=
instance_tree
.
getRelativeUrl
()
)
event
=
self
.
portal
.
event_module
.
newContent
(
portal_type
=
self
.
event_portal_type
,
destination_value
=
person
,
follow_up
=
support_request
.
getRelativeUrl
()
)
event
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
event
,
[
'G-COMPANY'
,
person
.
getUserId
(),
self
.
user_id
,
organisation
.
getReference
()],
False
)
self
.
assertRoles
(
event
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
event
,
person
.
getUserId
(),
[
'Auditor'
])
self
.
assertRoles
(
event
,
organisation
.
getReference
(),
[
'Auditor'
])
self
.
assertSecurityGroup
(
event
,
[
self
.
user_id
,
'%s_F-PRODAGNT'
%
project
.
getReference
(),
'%s_F-PRODMAN'
%
project
.
getReference
()],
False
)
self
.
assertRoles
(
event
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
event
,
'%s_F-PRODMAN'
%
project
.
getReference
(),
[
'Assignor'
])
self
.
assertRoles
(
event
,
'%s_F-PRODAGNT'
%
project
.
getReference
(),
[
'Assignee'
])
class
TestShortMessage
(
TestMailMessage
):
...
...
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