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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
preetwinder
erp5
Commits
aea026be
Commit
aea026be
authored
Jan 30, 2015
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workflow.py: get role_list from site/acl_users.
parent
b7740671
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
product/ERP5Workflow/Document/Workflow.py
product/ERP5Workflow/Document/Workflow.py
+6
-9
No files found.
product/ERP5Workflow/Document/Workflow.py
View file @
aea026be
...
@@ -56,12 +56,10 @@ class Workflow(XMLObject):
...
@@ -56,12 +56,10 @@ class Workflow(XMLObject):
isRADContent
=
1
isRADContent
=
1
### zwj: for security issue
### zwj: for security issue
managed_permission
=
()
managed_permission
_list
=
()
managed_role
=
()
managed_role
=
()
erp5_permission_roles
=
{}
# { permission: [role] or (role,) }
erp5_permission_roles
=
{}
# { permission: [role] or (role,) }
role_list
=
sorted
([
"Anonymous"
,
"Assignee"
,
"Assignor"
,
"Associate"
,
"Auditor"
,
"Authenticated"
,
"Author"
,
"Manager"
,
"Member"
,
"Owner"
,
"Reviewer"
])
# Declarative security
# Declarative security
security
=
ClassSecurityInfo
()
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
...
@@ -81,7 +79,6 @@ class Workflow(XMLObject):
...
@@ -81,7 +79,6 @@ class Workflow(XMLObject):
"""
"""
state_bc_id
=
self
.
getStateBaseCategory
()
state_bc_id
=
self
.
getStateBaseCategory
()
document
.
setCategoryMembership
(
state_bc_id
,
self
.
getSource
())
document
.
setCategoryMembership
(
state_bc_id
,
self
.
getSource
())
object
=
self
.
getStateChangeInformation
(
document
,
self
.
getSourceValue
())
object
=
self
.
getStateChangeInformation
(
document
,
self
.
getSourceValue
())
# Initialize workflow history
# Initialize workflow history
...
@@ -139,7 +136,7 @@ class Workflow(XMLObject):
...
@@ -139,7 +136,7 @@ class Workflow(XMLObject):
return
DateTime
()
return
DateTime
()
def
getManagedPermissionList
(
self
):
def
getManagedPermissionList
(
self
):
return
self
.
managed_permission
return
self
.
managed_permission
_list
def
getStateChangeInformation
(
self
,
document
,
state
,
transition
=
None
):
def
getStateChangeInformation
(
self
,
document
,
state
,
transition
=
None
):
"""
"""
...
@@ -170,7 +167,8 @@ class Workflow(XMLObject):
...
@@ -170,7 +167,8 @@ class Workflow(XMLObject):
"""Changes the object permissions according to the current state.
"""Changes the object permissions according to the current state.
"""
"""
changed
=
0
changed
=
0
sdef
=
sdef
=
document
.
_getDefaultAcquiredValue
(
self
.
getStateBaseCategory
())
sdef
=
document
.
_getDefaultAcquiredValue
(
self
.
getStateBaseCategory
())
managed_permission
=
self
.
getManagedPermissionList
()
if
sdef
is
None
:
if
sdef
is
None
:
return
0
return
0
### zwj: get all matrix cell objects
### zwj: get all matrix cell objects
...
@@ -179,7 +177,6 @@ class Workflow(XMLObject):
...
@@ -179,7 +177,6 @@ class Workflow(XMLObject):
for
perm_role
in
permission_role_matrix_cells
:
for
perm_role
in
permission_role_matrix_cells
:
permission
,
role
=
perm_role
.
getPermissionRole
()
permission
,
role
=
perm_role
.
getPermissionRole
()
### zwj: double check the right role and permission are obtained
### zwj: double check the right role and permission are obtained
#LOG('zwj: Assign %s to %s' %(role, permission), WARNING, "in Workflow.")
if
permission
!=
'None'
:
if
permission
!=
'None'
:
if
self
.
erp5_permission_roles
.
has_key
(
permission
):
if
self
.
erp5_permission_roles
.
has_key
(
permission
):
self
.
erp5_permission_roles
[
permission
]
+=
(
role
,)
self
.
erp5_permission_roles
[
permission
]
+=
(
role
,)
...
@@ -194,7 +191,7 @@ class Workflow(XMLObject):
...
@@ -194,7 +191,7 @@ class Workflow(XMLObject):
return
changed
return
changed
def
getRoleList
(
self
):
def
getRoleList
(
self
):
return
s
elf
.
role_list
return
s
orted
(
self
.
getPortalObject
().
getDefaultModule
(
'acl_users'
).
valid_roles
())
### Security feature end
### Security feature end
...
...
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