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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
738b7e0c
Commit
738b7e0c
authored
Jul 27, 2021
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Plain Diff
erp5_core: fix "Update Security Roles" on workflow
See merge request
nexedi/erp5!1469
parents
1c1ec0bc
bdc67d95
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
+16
-11
bt5/erp5_workflow_test/TestTemplateItem/portal_components/test.erp5.testWorkflowAndDCWorkflow.py
.../portal_components/test.erp5.testWorkflowAndDCWorkflow.py
+15
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Workflow_updateSecurityRoles.py
...em/portal_skins/erp5_core/Workflow_updateSecurityRoles.py
+1
-11
No files found.
bt5/erp5_workflow_test/TestTemplateItem/portal_components/test.erp5.testWorkflowAndDCWorkflow.py
View file @
738b7e0c
...
...
@@ -414,6 +414,21 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
# check worklist view is available on workflow
self
.
workflow
.
worklist_1_draft_test_workflow_document_list
.
view
()
def
test_17_testUpdateSecurityRole
(
self
):
text_document
=
self
.
getTestObject
()
self
.
assertEqual
(
text_document
.
_View_Permission
,
(
'Assignee'
,
'Assignor'
,
'Associate'
,
'Auditor'
,
'Author'
,
'Manager'
,
'Owner'
))
self
.
assertEqual
(
text_document
.
getValidationState
(),
'draft'
)
default_role_dict
=
self
.
workflow
.
state_draft
.
getStatePermissionRoleListDict
()
modified_role_dict
=
default_role_dict
.
copy
()
modified_role_dict
[
'View'
]
=
(
'Assignee'
,
'Assignor'
,
'Associate'
,
'Auditor'
,
'Author'
,
'Manager'
)
self
.
workflow
.
state_draft
.
setStatePermissionRoleListDict
(
modified_role_dict
)
self
.
tic
()
self
.
workflow
.
Workflow_updateSecurityRoles
()
self
.
tic
()
self
.
assertEqual
(
text_document
.
_View_Permission
,
(
'Assignee'
,
'Assignor'
,
'Associate'
,
'Auditor'
,
'Author'
,
'Manager'
))
self
.
workflow
.
state_draft
.
setStatePermissionRoleListDict
(
default_role_dict
)
self
.
tic
()
class
TestDCWorkflow
(
TestERP5WorkflowMixin
):
"""
Check DC Workflow works correctly in new Workflow Tool.
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Workflow_updateSecurityRoles.py
View file @
738b7e0c
...
...
@@ -3,17 +3,7 @@ def updateRoleMappings(self, REQUEST=None):
"""
Changes permissions of all objects related to this workflow
"""
# XXX(WORKFLOW) add test for roles update:
# - edit permission/roles on a workflow
# - check permission on an existing object of a type using this workflow
type_info_list
=
self
.
getParentValue
().
_listTypeInfo
()
workflow_id
=
self
.
getId
()
# check the workflow defined on the type objects
portal_type_id_list
=
[
portal_type
.
getId
()
for
portal_type
in
type_info_list
if
workflow_id
in
portal_type
.
getTypeWorkflowList
()
]
portal_type_id_list
=
self
.
getPortalTypeListForWorkflow
()
if
portal_type_id_list
:
object_list
=
self
.
portal_catalog
(
portal_type
=
portal_type_id_list
,
limit
=
None
)
portal_activities
=
self
.
portal_activities
...
...
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