Commit 14d6a6c6 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Added extensions from KM project and which can be useful to various developers.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27138 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4217c93c
No related merge requests found
def cloneSecurity(self, from_id, to_id):
"""
This methods copies roles from portal_type
from_id to portal_type to_id
"""
s = ''
from_pt = self[from_id]
to_pt = [self[x] for x in to_id]
for pt in to_pt:
pt._roles = ()
for role in from_pt._roles:
pt.addRole(
role.getId(),
role.Description(),
role.Title(),
role.getCondition(),
'\n'.join(role.getCategory()) or '',
role.getBaseCategoryScript(),
' '.join(role.getBaseCategory()) or '',
)
s+='%s\n' % pt
return s
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </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>"""\n
A quite generic script to clone security settings amont portal types.\n
from_type - a portal type id\n
to_type_list - a list of target types\n
Uses external method\n
"""\n
\n
print \'cloning role information from\'\n
print from_type\n
if to_type_list == ():\n
to_type_list = (to_type,)\n
print context.cloneRoleInformation(context.portal_types, from_type, to_type_list)\n
return printed\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>from_type, to_type_list=(), to_type=None</string> </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>3</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>from_type</string>
<string>to_type_list</string>
<string>to_type</string>
<string>_print_</string>
<string>_print</string>
<string>_getattr_</string>
<string>context</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<tuple/>
<none/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Type_cloneRoleInformation</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>cloneSecurity</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>SecurityCloner</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>cloneRoleInformation</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Ext. method to clone role information among portal types</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Glossary Glossary
PythonScriptParserUtility PythonScriptParserUtility
Security Security
\ No newline at end of file SecurityCloner
\ 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