Commit d79c4f8f authored by Romain Courteaud's avatar Romain Courteaud

Drop SoftwareType_getSecurityCategoryFromAggregateMovementItemByPerson.

Directly fetch person information from related Hosting Subscription.
parent 6051a7cb
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
</role> </role>
<role id='Assignee'> <role id='Assignee'>
<property id='title'>Customer of the Instance</property> <property id='title'>Customer of the Instance</property>
<property id='base_category_script'>SoftwareType_getSecurityCategoryFromAggregateMovementItemByPerson</property> <property id='base_category_script'>InstanceType_getSecurityCategoryFromUser</property>
<multi_property id='base_category'>destination_section</multi_property> <multi_property id='base_category'>destination_section</multi_property>
</role> </role>
<role id='Assignor'> <role id='Assignor'>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
</role> </role>
<role id='Assignee'> <role id='Assignee'>
<property id='title'>Customer of the Instance</property> <property id='title'>Customer of the Instance</property>
<property id='base_category_script'>SoftwareType_getSecurityCategoryFromAggregateMovementItemByPerson</property> <property id='base_category_script'>InstanceType_getSecurityCategoryFromUser</property>
<multi_property id='base_category'>destination_section</multi_property> <multi_property id='base_category'>destination_section</multi_property>
</role> </role>
<role id='Assignor'> <role id='Assignor'>
......
...@@ -50,48 +50,48 @@ ...@@ -50,48 +50,48 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string>"""\n
This script returns a list of dictionaries which represent\n
# XXX For now, this script requires proxy manager\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
# base_category_list : list of category values we need to retrieve\n - calculate a security group based on a given\n
# user_name : string obtained from getSecurityManager().getUser().getUserName() [NuxUserGroup]\n category of the current object (ex. group). This\n
# or from getSecurityManager().getUser().getId() [PluggableAuthService with ERP5GroupManager]\n is used for example in ERP5 DMS to calculate\n
# object : object which we want to assign roles to.\n document security.\n
# portal_type : portal type of object\n
\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
The parameters are\n
\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
NOTE: for now, this script requires proxy manager\n
"""\n
\n \n
category_list = []\n category_list = []\n
\n \n
if obj is None:\n if obj is None:\n
return []\n return []\n
\n \n
movement_portal_type = ["Sale Packing List Line", "Sale Order Line"]\n hosting_subscription = obj.getSpecialiseValue(portal_type="Hosting Subscription")\n
\n if hosting_subscription is not None:\n
portal = obj.getPortalObject()\n person = hosting_subscription.getDestinationSectionValue(portal_type="Person")\n
\n if person is not None:\n
security_dict = {}\n
\n \n
parent_url_list = []\n for base_category in base_category_list:\n
for movement in portal.portal_catalog(\n category_list.append({base_category: [person.getRelativeUrl()]})\n
portal_type=movement_portal_type,\n
strict_aggregate_uid=obj.getUid(),\n
default_resource_uid=portal.restrictedTraverse(portal.portal_preferences.getPreferredInstanceSetupResource()).getUid(),\n
# simulation_state=(\'ordered\', \'confirmed\', \'started\', \'stopped\'),\n
limit=1,\n
):\n
item = movement.getDestinationSectionValue(portal_type="Person")\n
if item is not None:\n
parent_url_list.append(item.getRelativeUrl())\n
\n \n
if len(parent_url_list) > 0:\n
parent_url_list.sort()\n
category_list.append({"destination_section": parent_url_list})\n
return category_list\n return category_list\n
</string> </value>
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
...@@ -107,7 +107,7 @@ return category_list\n ...@@ -107,7 +107,7 @@ return category_list\n
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>SoftwareType_getSecurityCategoryFromAggregateMovementItemByPerson</string> </value> <value> <string>InstanceType_getSecurityCategoryFromUser</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
6 7
\ No newline at end of file \ No newline at end of file
509 510
\ 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