diff --git a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/ERP5Type_getSecurityCategoryFromDestination.xml b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/ERP5Type_getSecurityCategoryFromDestination.xml new file mode 100644 index 0000000000000000000000000000000000000000..d6a34fbc036d0d7996a23eb090456bdef5d420a3 --- /dev/null +++ b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/ERP5Type_getSecurityCategoryFromDestination.xml @@ -0,0 +1,189 @@ +<?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># here we calculate permissions for a memo - we must find the recipient\n +\n +context.log(base_category_list)\n +category_list = []\n +\n +for ob in object.getDestinationValueList():\n + context.log(ob.getRelativeUrl())\n + category_dict = {}\n + for base_category in base_category_list:\n + if base_category==\'group\':\n + category_value=ob.Person_getGroup()\n + else:\n + category_value = ob.getProperty(base_category)\n + if category_value not in (None, \'\'):\n + category_dict[base_category] = category_value\n + else:\n + raise RuntimeError, "Error: \'%s\' property is required in order to update person security group" % (base_category)\n + category_list.append(category_dict)\n +context.log(category_list)\n +return category_list\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>base_category_list, user_name, object, portal_type</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>4</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>base_category_list</string> + <string>user_name</string> + <string>object</string> + <string>portal_type</string> + <string>_getattr_</string> + <string>context</string> + <string>category_list</string> + <string>_getiter_</string> + <string>ob</string> + <string>category_dict</string> + <string>base_category</string> + <string>category_value</string> + <string>None</string> + <string>_write_</string> + <string>RuntimeError</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>ERP5Type_getSecurityCategoryFromDestination</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/ERP5Type_getSecurityCategoryFromDestinationAssignment.xml b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/ERP5Type_getSecurityCategoryFromDestinationAssignment.xml new file mode 100644 index 0000000000000000000000000000000000000000..8ce95a6f0379c081c7217aa88e059b32de054550 --- /dev/null +++ b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/ERP5Type_getSecurityCategoryFromDestinationAssignment.xml @@ -0,0 +1,190 @@ +<?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>context.log(base_category_list)\n +category_list = []\n +\n +# We look for valid assignments of destination users\n +for person_object in object.getDestinationValueList(portal_type=\'Person\'):\n + for assignment in person_object.contentValues(filter={\'portal_type\': \'Assignment\'}):\n + if assignment.getValidationState() == \'open\':\n + category_dict = {}\n + for base_category in base_category_list:\n + if base_category==\'source_project\':\n + category_value=assignment.getDestinationProject()\n + else:\n + category_value = assignment.getProperty(base_category)\n + if category_value not in (None, \'\'):\n + category_dict[base_category] = category_value\n + else:\n + raise RuntimeError, "Error: \'%s\' property is required in order to update person security group" % (base_category)\n + category_list.append(category_dict)\n +context.log(category_list)\n +return category_list\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>base_category_list, user_name, object, portal_type</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>4</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>base_category_list</string> + <string>user_name</string> + <string>object</string> + <string>portal_type</string> + <string>_getattr_</string> + <string>context</string> + <string>category_list</string> + <string>_getiter_</string> + <string>person_object</string> + <string>assignment</string> + <string>category_dict</string> + <string>base_category</string> + <string>category_value</string> + <string>None</string> + <string>_write_</string> + <string>RuntimeError</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>ERP5Type_getSecurityCategoryFromDestinationAssignment</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/ERP5Type_getSecurityCategoryFromObjectAssignment.xml b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/ERP5Type_getSecurityCategoryFromObjectAssignment.xml new file mode 100644 index 0000000000000000000000000000000000000000..56da4a87f11d8e3f9c98d7efe6a6225f6eecad75 --- /dev/null +++ b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/ERP5Type_getSecurityCategoryFromObjectAssignment.xml @@ -0,0 +1,195 @@ +<?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># here we calculate permissions for a Person, so we need categories from his assignment\n +\n +# must always return a list of dicts\n +\n +context.log(base_category_list)\n +category_list = []\n +\n +person_object = object\n +\n +# We look for valid assignments of this user\n +for assignment in person_object.contentValues(filter={\'portal_type\': \'Assignment\'}):\n + if assignment.getValidationState() == \'open\':\n + category_dict = {}\n + for base_category in base_category_list:\n + if base_category==\'source_project\':\n + category_value=assignment.getDestinationProject()\n + else:\n + category_value = assignment.getProperty(base_category)\n + if category_value not in (None, \'\'):\n + category_dict[base_category] = category_value\n + else:\n + raise RuntimeError, "Error: \'%s\' property is required in order to update person security group" % (base_category)\n + category_list.append(category_dict)\n +context.log(category_list)\n +return category_list\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>base_category_list, user_name, object, portal_type</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>4</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>base_category_list</string> + <string>user_name</string> + <string>object</string> + <string>portal_type</string> + <string>_getattr_</string> + <string>context</string> + <string>category_list</string> + <string>person_object</string> + <string>_getiter_</string> + <string>assignment</string> + <string>category_dict</string> + <string>base_category</string> + <string>category_value</string> + <string>None</string> + <string>_write_</string> + <string>RuntimeError</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>ERP5Type_getSecurityCategoryFromObjectAssignment</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData>