Commit ac1d7e3c authored by Jérome Perrin's avatar Jérome Perrin

Use MembershipTool rather than Security Manager to check permission.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6056 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 574124e6
...@@ -67,7 +67,6 @@ ...@@ -67,7 +67,6 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from ZTUtils import make_query\n <value> <string>from ZTUtils import make_query\n
from AccessControl import getSecurityManager\n
N_ = context.Base_translateString\n N_ = context.Base_translateString\n
\n \n
search_method = getattr(context, \'get%sRelatedList\' %\n search_method = getattr(context, \'get%sRelatedList\' %\n
...@@ -98,11 +97,12 @@ elif len(related_list) == 1:\n ...@@ -98,11 +97,12 @@ elif len(related_list) == 1:\n
url = context.absolute_url()\n url = context.absolute_url()\n
message = N_("You are not authorized to view the related document.")\n message = N_("You are not authorized to view the related document.")\n
else :\n else :\n
checkPerm = context.portal_membership.checkPermission\n
# compute the list of objects we are actually authorized to view\n # compute the list of objects we are actually authorized to view\n
related_object_list = []\n related_object_list = []\n
for path in search_method(portal_type=portal_type) :\n for path in search_method(portal_type=portal_type) :\n
obj = context.restrictedTraverse(path, None)\n obj = context.restrictedTraverse(path, None)\n
if obj is not None and getSecurityManager().validate("View", obj):\n if obj is not None and checkPerm("View", obj):\n
related_object_list.append(obj)\n related_object_list.append(obj)\n
if len(related_object_list) == 0 :\n if len(related_object_list) == 0 :\n
url = context.absolute_url()\n url = context.absolute_url()\n
...@@ -170,8 +170,6 @@ context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n ...@@ -170,8 +170,6 @@ context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n
<string>portal_type</string> <string>portal_type</string>
<string>ZTUtils</string> <string>ZTUtils</string>
<string>make_query</string> <string>make_query</string>
<string>AccessControl</string>
<string>getSecurityManager</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>N_</string> <string>N_</string>
...@@ -191,6 +189,7 @@ context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n ...@@ -191,6 +189,7 @@ context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n
<string>None</string> <string>None</string>
<string>related_object</string> <string>related_object</string>
<string>unicode</string> <string>unicode</string>
<string>checkPerm</string>
<string>related_object_list</string> <string>related_object_list</string>
<string>path</string> <string>path</string>
<string>obj</string> <string>obj</string>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment