Commit f3a6d288 authored by Sebastien Robin's avatar Sebastien Robin

fixed security setting in counter_date workflow

added script in order to know the list of function for an user
add cache in script wich retrieve the list of sites for a particuler user

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11003 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 597e421c
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
# get the current logged user site\n
\n
from Products.ERP5Type.Cache import CachingMethod\n
\n
if user_id is None:\n
user_id = context.portal_membership.getAuthenticatedMember().getUserName()\n
\n
def getFunctionList(user_id=user_id):\n
\n
valid_assignment_list = context.Baobab_getUserAssignmentList(user_id=user_id)\n
\n
function_list = []\n
for a in valid_assignment_list:\n
new_function_list = a.getFunctionList()\n
if len(new_function_list)>0:\n
function_list.extend(new_function_list)\n
return function_list\n
\n
getFunctionList = CachingMethod(getFunctionList, id=\'Baobab_getUserAssignedFunctionList\', cache_duration=300)\n
return getFunctionList()\n
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>user_id=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>user_id</string>
<string>Products.ERP5Type.Cache</string>
<string>CachingMethod</string>
<string>None</string>
<string>_getattr_</string>
<string>context</string>
<string>getFunctionList</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Baobab_getUserAssignedFunctionList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -70,14 +70,24 @@ ...@@ -70,14 +70,24 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string># get the current logged user site\n <value> <string># get the current logged user site\n
\n \n
valid_assignment_list = context.Baobab_getUserAssignmentList(user_id=user_id)\n from Products.ERP5Type.Cache import CachingMethod\n
\n \n
site_list = []\n if user_id is None:\n
for a in valid_assignment_list:\n user_id = context.portal_membership.getAuthenticatedMember().getUserName()\n
\n
def getSiteList(user_id=user_id):\n
\n
valid_assignment_list = context.Baobab_getUserAssignmentList(user_id=user_id)\n
\n
site_list = []\n
for a in valid_assignment_list:\n
new_site = a.getSite()\n new_site = a.getSite()\n
if new_site not in (\'\', None):\n if new_site not in (\'\', None):\n
site_list.append(new_site)\n site_list.append(new_site)\n
return site_list\n return site_list\n
\n
getSiteList = CachingMethod(getSiteList, id=\'Baobab_getUserAssignedSiteList\', cache_duration=300)\n
return getSiteList(user_id=user_id)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -135,14 +145,12 @@ return site_list\n ...@@ -135,14 +145,12 @@ return site_list\n
<value> <value>
<tuple> <tuple>
<string>user_id</string> <string>user_id</string>
<string>Products.ERP5Type.Cache</string>
<string>CachingMethod</string>
<string>None</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>valid_assignment_list</string> <string>getSiteList</string>
<string>site_list</string>
<string>_getiter_</string>
<string>a</string>
<string>new_site</string>
<string>None</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -76,6 +76,7 @@ ...@@ -76,6 +76,7 @@
<tuple> <tuple>
<string>Assignor</string> <string>Assignor</string>
<string>Manager</string> <string>Manager</string>
<string>Member</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -94,6 +95,7 @@ ...@@ -94,6 +95,7 @@
<tuple> <tuple>
<string>Assignor</string> <string>Assignor</string>
<string>Manager</string> <string>Manager</string>
<string>Member</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
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