Commit 9525bd5c authored by Jérome Perrin's avatar Jérome Perrin

accessing context in workflow script is Unauthorized for non Manager users

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18134 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ceb057c7
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<string>Products.PythonScripts.PythonScript</string> <tuple/>
<string>PythonScript</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
...@@ -72,19 +69,22 @@ ...@@ -72,19 +69,22 @@
This script tries to send a message to the appropriate recipient\n This script tries to send a message to the appropriate recipient\n
from the appropriate sender. It uses portal_notifications\n from the appropriate sender. It uses portal_notifications\n
and the getObject API of ERP5Catalog.\n and the getObject API of ERP5Catalog.\n
This script has a proxy role to make sure we can find person documents in the\n
catalog.\n
"""\n """\n
from Products.ERP5Type.Log import log\n from Products.ERP5Type.Log import log\n
\n \n
object = sci[\'object\']\n object = sci[\'object\']\n
translateString = context.Base_translateString\n portal = sci.getPortal()\n
portal_catalog = object.portal_catalog\n translateString = portal.Base_translateString\n
portal_catalog = portal.portal_catalog\n
\n \n
# Get the owner\n # Get the owner\n
owner = object.getViewPermissionOwner()\n owner = object.getViewPermissionOwner()\n
owner_value = portal_catalog.getResultValue(portal_type=\'Person\', reference=owner)\n owner_value = portal_catalog.getResultValue(portal_type=\'Person\', reference=owner)\n
\n \n
# Get the authenticated user\n # Get the authenticated user\n
user = context.portal_membership.getAuthenticatedMember().getUserName()\n user = portal.portal_membership.getAuthenticatedMember().getUserName()\n
user_value = portal_catalog.getResultValue(portal_type=\'Person\', reference=user)\n user_value = portal_catalog.getResultValue(portal_type=\'Person\', reference=user)\n
\n \n
# If users are not defined, we need to log and return\n # If users are not defined, we need to log and return\n
...@@ -183,7 +183,7 @@ context.portal_notifications.sendMessage(sender=user, recipient=owner, subject=s ...@@ -183,7 +183,7 @@ context.portal_notifications.sendMessage(sender=user, recipient=owner, subject=s
<string>_getitem_</string> <string>_getitem_</string>
<string>object</string> <string>object</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>portal</string>
<string>translateString</string> <string>translateString</string>
<string>portal_catalog</string> <string>portal_catalog</string>
<string>owner</string> <string>owner</string>
...@@ -194,6 +194,7 @@ context.portal_notifications.sendMessage(sender=user, recipient=owner, subject=s ...@@ -194,6 +194,7 @@ context.portal_notifications.sendMessage(sender=user, recipient=owner, subject=s
<string>subject</string> <string>subject</string>
<string>msg</string> <string>msg</string>
<string>dict</string> <string>dict</string>
<string>context</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
257 258
\ 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