diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Person_afterClone.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Person_afterClone.xml new file mode 100644 index 0000000000000000000000000000000000000000..fce6b6d312b3a20748c3c7576fb9e72a17bbcf35 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Person_afterClone.xml @@ -0,0 +1,148 @@ +<?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>"""Hook called when a person object is closed.\n +\n +We want to reset the reference, which is the user login in ERP5Security.\n +"""\n +context.setReference(None)\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>_params</string> </key> + <value> <string></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>0</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>_getattr_</string> + <string>context</string> + <string>None</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>Person_afterClone</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/product/ERP5/bootstrap/erp5_core/bt/change_log b/product/ERP5/bootstrap/erp5_core/bt/change_log index 1adc81dacb601faca3fb5daee9c247d3ad609652..8328cae27b37912f4b24b76973168415d4adbaaa 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/change_log +++ b/product/ERP5/bootstrap/erp5_core/bt/change_log @@ -1,3 +1,6 @@ +2006-08-11 jerome +* when copy/paste a person, reset the login on the new person for ERP5Security. + 2006-08-06 jerome * remove skins to create module using a scribus file; they are now part of erp5_pdf_editor. diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision index c24b6ae77df02a87472b208f251fad88382a2e55..86ee83a4a26867a79e0a5a8948153cff8f4cf9a4 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/revision +++ b/product/ERP5/bootstrap/erp5_core/bt/revision @@ -1 +1 @@ -38 \ No newline at end of file +40 \ No newline at end of file diff --git a/product/ERP5Security/tests/testERP5Security.py b/product/ERP5Security/tests/testERP5Security.py index 3f2987bfb0c9a1dfe950663989123e7fe52710e8..404df9ba048e3635695ed3bd02268f996ec2cc68 100644 --- a/product/ERP5Security/tests/testERP5Security.py +++ b/product/ERP5Security/tests/testERP5Security.py @@ -188,6 +188,15 @@ class TestERP5Security(ERP5TypeTestCase): self._makePerson(reference='new_person') self.assertRaises(RuntimeError, self._makePerson, reference='new_person') + def test_PersonCopyAndPaste(self, run=RUN_ALL_TESTS): + """If we copy and paste a person, login must not be copyied.""" + person = self._makePerson(reference='new_person') + person_module = self.getPersonModule() + copy_data = person_module.manage_copyObjects([person.getId()]) + changed, = person_module.manage_pasteObjects(copy_data) + self.assertNotEquals(person_module[changed['new_id']].getReference(), + person_module[changed['id']].getReference()) + if __name__ == '__main__': framework() else: