Commit 8a2f194a authored by Romain Courteaud's avatar Romain Courteaud

Check if the user is allowed to clone the document.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18813 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0f695a3d
...@@ -82,6 +82,14 @@ if clone:\n ...@@ -82,6 +82,14 @@ if clone:\n
else:\n else:\n
portal_type = form_data[\'clone_portal_type\']\n portal_type = form_data[\'clone_portal_type\']\n
\n \n
parent = context.getParentValue()\n
allowed_type_list = parent.getVisibleAllowedContentTypeList()\n
if portal_type not in allowed_type_list:\n
return context.ERP5Site_redirect(\'%s/%s/view\' % (\n
parent.getUrl(), context.getId()),\n
keep_items={\'portal_status_message\':\n
translateString("You are not allowed to clone this object.")})\n
\n
# prepare query params\n # prepare query params\n
kw = {\'portal_type\' : portal_type}\n kw = {\'portal_type\' : portal_type}\n
\n \n
...@@ -162,6 +170,8 @@ return new_object.Base_redirect(form_id, \n ...@@ -162,6 +170,8 @@ return new_object.Base_redirect(form_id, \n
<string>form_data</string> <string>form_data</string>
<string>portal_type</string> <string>portal_type</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>parent</string>
<string>allowed_type_list</string>
<string>kw</string> <string>kw</string>
<string>getattr</string> <string>getattr</string>
<string>None</string> <string>None</string>
......
484 485
\ No newline at end of file \ No newline at end of file
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