Commit ff733d03 authored by Romain Courteaud's avatar Romain Courteaud

Drop ERP5Type_getSecurityCategoryFromAggregateMovementItemByComputerPartition.

No need to use packing list to find related documents.
parent a706ba09
<type_roles>
<role id='Assignor'>
<property id='title'>Computer</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromAggregateMovementItemByComputerPartition</property>
<property id='base_category_script'>getSecurityCategoryFromContentParent</property>
<multi_property id='base_category'>aggregate</multi_property>
</role>
<role id='Assignee'>
......
<type_roles>
<role id='Assignor'>
<property id='title'>Computer</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromAggregateMovementItemByComputerPartition</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContentParent</property>
<multi_property id='base_category'>aggregate</multi_property>
</role>
<role id='Assignee'>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>business_template_skin_layer_priority</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>float</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>business_template_skin_layer_priority</string> </key>
<value> <float>60.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>slapos_core</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -50,50 +50,43 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
# XXX For now, this script requires proxy manager\n
<value> <string>"""\n
This script returns a list of dictionaries which represent\n
the security groups which a person is member of. It extracts\n
the categories from the current content. It is useful in the\n
following cases:\n
\n
# base_category_list : list of category values we need to retrieve\n
# user_name : string obtained from getSecurityManager().getUser().getUserName() [NuxUserGroup]\n
# or from getSecurityManager().getUser().getId() [PluggableAuthService with ERP5GroupManager]\n
# object : object which we want to assign roles to.\n
# portal_type : portal type of object\n
- calculate a security group based on a given\n
category of the current object (ex. group). This\n
is used for example in ERP5 DMS to calculate\n
document security.\n
\n
# must always return a list of dicts\n
- assign local roles to a document based on\n
the person which the object related to through\n
a given base category (ex. destination). This\n
is used for example in ERP5 Project to calculate\n
Task / Task Report security.\n
\n
category_list = []\n
The parameters are\n
\n
if obj is None:\n
return []\n
base_category_list -- list of category values we need to retrieve\n
user_name -- string obtained from getSecurityManager().getUser().getId()\n
object -- object which we want to assign roles to\n
portal_type -- portal type of object\n
\n
item_portal_type = "Computer Partition"\n
movement_portal_type = "Sale Packing List Line"\n
NOTE: for now, this script requires proxy manager\n
"""\n
\n
portal = obj.getPortalObject()\n
category_list = []\n
\n
security_dict = {}\n
if object is None:\n
return []\n
\n
parent_url_list = []\n
for movement in portal.portal_catalog(\n
portal_type=movement_portal_type,\n
aggregate_uid=obj.getUid(),\n
default_resource_uid=portal.restrictedTraverse(portal.portal_preferences.getPreferredInstanceSetupResource()).getUid(),\n
simulation_state=(\'stopped\', \'delivered\') + portal.getPortalReservedInventoryStateList() + portal.getPortalTransitInventoryStateList(),\n
):\n
item = movement.getAggregateValue(portal_type=item_portal_type)\n
if item is not None:\n
parent_url = item.getParentValue().getRelativeUrl()\n
if parent_url not in parent_url_list:\n
parent_url_list.append(parent_url)\n
for base_category in base_category_list:\n
category_list.append({base_category: [x.getParentValue().getRelativeUrl() for x in object.getValueList(base_category)]})\n
\n
if len(parent_url_list) > 0:\n
parent_url_list.sort()\n
category_list.append({"aggregate": parent_url_list})\n
return category_list\n
]]></string> </value>
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
......@@ -109,7 +102,7 @@ return category_list\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Type_getSecurityCategoryFromAggregateMovementItemByComputerPartition</string> </value>
<value> <string>ERP5Type_getSecurityCategoryFromContentParent</string> </value>
</item>
</dictionary>
</pickle>
......
5
\ No newline at end of file
6
\ No newline at end of file
slapos_core
\ No newline at end of file
508
\ No newline at end of file
509
\ 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