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
dd7af1b9
Commit
dd7af1b9
authored
Jun 23, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for TALES guard on PythonScript/ExternalMethod
parent
81de15db
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
25 deletions
+7
-25
product/ERP5Type/dtml/editGuardForm.dtml
product/ERP5Type/dtml/editGuardForm.dtml
+5
-22
product/ERP5Type/patches/PythonScript.py
product/ERP5Type/patches/PythonScript.py
+2
-3
No files found.
product/ERP5Type/dtml/editGuardForm.dtml
View file @
dd7af1b9
...
...
@@ -2,27 +2,10 @@
<dtml-var manage_tabs>
<form action="manage_setGuard" method="POST">
<table>
<tr>
<th align="left" valign="top">Guard</th>
<td>
<dtml-with getGuard>
<table>
<tr>
<th align="left">Permission(s)</th>
<td><input type="text" name="guard_permissions" value="&dtml-getPermissionsText;" /></td>
<th align="left">Role(s)</th>
<td><input type="text" name="guard_roles" value="&dtml-getRolesText;" /></td>
<th align="left">Group(s)</th>
<td><input type="text" name="guard_groups" value="&dtml-getGroupsText;" /></td>
</tr>
</table>
</dtml-with>
</td>
</tr>
</table>
<input type="submit" name="submit" value="Save changes" />
<dtml-with getGuard>
<dtml-var guardForm>
</dtml-with>
<input type="submit" name="submit" value="Save changes" />
</form>
<dtml-var manage_page_footer>
product/ERP5Type/patches/PythonScript.py
View file @
dd7af1b9
...
...
@@ -14,6 +14,7 @@ from Products.DCWorkflow.Guard import Guard
from
Products.PythonScripts.PythonScript
import
PythonScript
from
App.special_dtml
import
DTMLFile
from
..
import
_dtmldir
from
..Utils
import
createExpressionContext
from
AccessControl
import
ClassSecurityInfo
,
getSecurityManager
from
AccessControl.class_init
import
InitializeClass
from
AccessControl.PermissionRole
import
rolesForPermissionOn
...
...
@@ -121,8 +122,6 @@ def getRoles(ob):
def
_checkGuard
(
guard
,
ob
):
# returns 1 if guard passes against ob, else 0.
# TODO : implement TALES evaluation by defining an appropriate
# context.
if
guard
.
permissions
:
# Require at least one role for required roles for the given permission.
u_roles
=
getRoles
(
ob
)
...
...
@@ -155,7 +154,7 @@ def _checkGuard(guard, ob):
break
else
:
return
0
return
1
return
guard
.
expr
is
None
or
guard
.
expr
(
createExpressionContext
(
ob
))
def
checkGuard
(
aq_base
=
aq_base
,
aq_parent
=
aq_parent
,
_checkGuard
=
_checkGuard
):
def
checkGuard
(
self
,
_exec
=
False
):
...
...
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