Commit f37265d6 authored by Romain Courteaud's avatar Romain Courteaud

Drop ERP5Type_getSecurityCategoryFromSoftwareInstance.

Directly access document from local link.
parent 3afac93d
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</role> </role>
<role id='Assignor'> <role id='Assignor'>
<property id='title'>Software Instance which provides this Slave Instance</property> <property id='title'>Software Instance which provides this Slave Instance</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromSoftwareInstance</property> <property id='base_category_script'>SlaveInstanceType_getSecurityCategoryFromSoftwareInstance</property>
<multi_property id='base_category'>aggregate</multi_property> <multi_property id='base_category'>aggregate</multi_property>
</role> </role>
</type_roles> </type_roles>
\ No newline at end of file
...@@ -50,46 +50,47 @@ ...@@ -50,46 +50,47 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string># 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 \n
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery\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 \n
if obj is None:\n - assign local roles to a document based on\n
return []\n the person which the object related to through\n
\n a given base category (ex. destination). This\n
movement_portal_type = "Sale Packing List Line"\n is used for example in ERP5 Project to calculate\n
portal = obj.getPortalObject()\n Task / Task Report security.\n
\n
state_list = portal.getPortalCurrentInventoryStateList() + \\\n
portal.getPortalReservedInventoryStateList() + \\\n
portal.getPortalTransitInventoryStateList()\n
\n \n
movement = portal.portal_catalog.getResultValue(\n The parameters are\n
portal_type=movement_portal_type,\n
aggregate_uid=obj.getUid(),\n
simulation_state=state_list,\n
)\n
\n \n
if movement is None:\n base_category_list -- list of category values we need to retrieve\n
return []\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 \n
computer_partition = movement.getAggregateValue(portal_type="Computer Partition")\n NOTE: for now, this script requires proxy manager\n
software_release = movement.getAggregateValue(portal_type="Software Release")\n """\n
\n \n
query = ComplexQuery(\n category_list = []\n
Query(aggregate_relative_url=computer_partition.getRelativeUrl()),\n
Query(aggregate_relative_url=software_release.getRelativeUrl()),\n
operator="AND",\n
)\n
\n \n
catalog_result = portal.portal_catalog(portal_type=movement_portal_type,\n if obj is None:\n
simulation_state=state_list,\n return []\n
aggregate_relative_url=query)\n
\n \n
for item in catalog_result:\n partition = obj.getAggregateValue(portal_type="Computer Partition")\n
software_instance = item.getAggregateValue(portal_type="Software Instance")\n if partition is not None:\n
software_instance = partition.getPortalObject().portal_catalog.getResultValue(\n
portal_type="Software Instance", validation_state="validated", default_aggregate_uid=partition.getUid())\n
if software_instance is not None:\n if software_instance is not None:\n
return [{"aggregate": [software_instance.getRelativeUrl()]}]\n for base_category in base_category_list:\n
category_list.append({base_category: [software_instance.getRelativeUrl()]})\n
\n
return category_list\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -106,7 +107,7 @@ for item in catalog_result:\n ...@@ -106,7 +107,7 @@ for item in catalog_result:\n
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>ERP5Type_getSecurityCategoryFromSoftwareInstance</string> </value> <value> <string>SlaveInstanceType_getSecurityCategoryFromSoftwareInstance</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
9 10
\ No newline at end of file \ No newline at end of file
511 512
\ 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