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
Amer
erp5
Commits
ffe4bb2c
Commit
ffe4bb2c
authored
Jul 10, 2015
by
wenjie.zheng
Committed by
Sebastien Robin
Jul 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workflow.py: add Guard_checkWithoutRoles for worklist.
parent
b5510ec4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
product/ERP5Workflow/Document/Workflow.py
product/ERP5Workflow/Document/Workflow.py
+46
-0
No files found.
product/ERP5Workflow/Document/Workflow.py
View file @
ffe4bb2c
...
...
@@ -1036,3 +1036,49 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
out
.
append
(
'}'
)
return
'
\
n
'
.
join
(
out
)
def
Guard_checkWithoutRoles
(
self
,
sm
,
wf_def
,
ob
,
**
kw
):
"""Checks conditions in this guard.
This function is the same as Guard.check, but roles are not taken
into account here (but taken into account as local roles). This version
is for worklist guards.
Note that this patched version is not a monkey patch on the class,
because we only want this specific behaviour for worklists (Guards are
also used in transitions).
"""
u_roles
=
None
if
wf_def
.
manager_bypass
:
# Possibly bypass.
u_roles
=
sm
.
getUser
().
getRolesInContext
(
ob
)
if
'Manager'
in
u_roles
:
return
1
if
self
.
permissions
:
for
p
in
self
.
permissions
:
if
_checkPermission
(
p
,
ob
):
break
else
:
return
0
if
self
.
groups
:
# Require at least one of the specified groups.
u
=
sm
.
getUser
()
b
=
aq_base
(
u
)
if
hasattr
(
b
,
'getGroupsInContext'
):
u_groups
=
u
.
getGroupsInContext
(
ob
)
elif
hasattr
(
b
,
'getGroups'
):
u_groups
=
u
.
getGroups
()
else
:
u_groups
=
()
for
group
in
self
.
groups
:
if
group
in
u_groups
:
break
else
:
return
0
expr
=
self
.
expr
if
expr
is
not
None
:
econtext
=
createExprContext
(
StateChangeInfo
(
ob
,
wf_def
,
kwargs
=
kw
))
res
=
expr
(
econtext
)
if
not
res
:
return
0
return
1
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