Commit 6c601e66 authored by Jérome Perrin's avatar Jérome Perrin

don't create an user preference if this script is called by anonymous (typical...

don't create an user preference if this script is called by anonymous (typical use case: web site registration)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35163 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 58f09383
...@@ -54,11 +54,15 @@ ...@@ -54,11 +54,15 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>if REQUEST is not None:\n <value> <string>if REQUEST is not None:\n
from AccessControl import Unauthorized\n from zExceptions import Unauthorized\n
raise Unauthorized(script.getId())\n raise Unauthorized(script.getId())\n
\n \n
portal = context.getPortalObject()\n
if portal.portal_membership.isAnonymousUser():\n
return\n
\n
from Products.ERP5Type.Message import translateString\n from Products.ERP5Type.Message import translateString\n
preference = context.getPortalObject().portal_preferences.createPreferenceForUser(\n preference = portal.portal_preferences.createPreferenceForUser(\n
context.getReference())\n context.getReference())\n
\n \n
preference.setTitle(translateString(\'Preference for ${name}\',\n preference.setTitle(translateString(\'Preference for ${name}\',\n
...@@ -117,13 +121,14 @@ preference.enable()\n ...@@ -117,13 +121,14 @@ preference.enable()\n
<tuple> <tuple>
<string>REQUEST</string> <string>REQUEST</string>
<string>None</string> <string>None</string>
<string>AccessControl</string> <string>zExceptions</string>
<string>Unauthorized</string> <string>Unauthorized</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>script</string> <string>script</string>
<string>context</string>
<string>portal</string>
<string>Products.ERP5Type.Message</string> <string>Products.ERP5Type.Message</string>
<string>translateString</string> <string>translateString</string>
<string>context</string>
<string>preference</string> <string>preference</string>
<string>dict</string> <string>dict</string>
<string>_getiter_</string> <string>_getiter_</string>
......
...@@ -70,6 +70,14 @@ if sci[\'object\'].getReference():\n ...@@ -70,6 +70,14 @@ if sci[\'object\'].getReference():\n
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>sci</string> </value> <value> <string>sci</string> </value>
</item> </item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
<value> <value>
......
730 731
\ 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