Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Carlos Ramos Carreño
erp5
Commits
7d6df387
Commit
7d6df387
authored
Jan 23, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testSecurity: adjust test_workflow_transition_protection
Only "user action" methods needs a security declaration.
parent
b8e4bc38
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
product/ERP5/tests/testSecurity.py
product/ERP5/tests/testSecurity.py
+3
-2
No files found.
product/ERP5/tests/testSecurity.py
View file @
7d6df387
...
@@ -31,6 +31,7 @@ import unittest
...
@@ -31,6 +31,7 @@ import unittest
from
types
import
MethodType
from
types
import
MethodType
from
Acquisition
import
aq_base
from
Acquisition
import
aq_base
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.DCWorkflow.Transitions
import
TRIGGER_USER_ACTION
# You can invoke security tests in your favourite collection of business templates
# You can invoke security tests in your favourite collection of business templates
# by using TestSecurityMixin like the following :
# by using TestSecurityMixin like the following :
...
@@ -117,8 +118,8 @@ class TestSecurityMixin(ERP5TypeTestCase):
...
@@ -117,8 +118,8 @@ class TestSecurityMixin(ERP5TypeTestCase):
if
wf
.
__class__
.
__name__
==
'InteractionWorkflowDefinition'
:
if
wf
.
__class__
.
__name__
==
'InteractionWorkflowDefinition'
:
continue
continue
for
transition
in
wf
.
transitions
.
objectValues
():
for
transition
in
wf
.
transitions
.
objectValues
():
if
getattr
(
transition
,
'trigger_type'
,
1
)
==
0
:
if
getattr
(
transition
,
'trigger_type'
,
-
1
)
!=
TRIGGER_USER_ACTION
:
#
Automatic transition without guard is safe
#
Only user action workflow transitions needs a security definition.
continue
continue
if
getattr
(
transition
,
'guard'
,
None
)
is
None
:
if
getattr
(
transition
,
'guard'
,
None
)
is
None
:
error_list
.
append
(
'%s/transitions/%s'
%
(
wf
.
getId
(),
transition
.
getId
()))
error_list
.
append
(
'%s/transitions/%s'
%
(
wf
.
getId
(),
transition
.
getId
()))
...
...
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