Commit 3ee1dfb0 authored by Jérome Perrin's avatar Jérome Perrin

base: don't check unicity when migrating Person.reference to user_id

This activity is spawned on all nodes, which cause too many conflicts.
We can take the risk here, assuming that references were already OK
before migration.
parent f8cd3922
...@@ -5,7 +5,8 @@ def migrateToERP5Login(self): ...@@ -5,7 +5,8 @@ def migrateToERP5Login(self):
# no user id and no login is required # no user id and no login is required
return return
if not self.hasUserId() or self.getUserId() == reference: if not self.hasUserId() or self.getUserId() == reference:
self.setUserId(reference) self._baseSetUserId(reference)
self.reindexObject()
if not self.hasPassword(): if not self.hasPassword():
# no login is required, but possibly another Login type object is required if implemented # no login is required, but possibly another Login type object is required if implemented
return return
......
...@@ -785,6 +785,7 @@ class TestMigration(UserManagementTestCase): ...@@ -785,6 +785,7 @@ class TestMigration(UserManagementTestCase):
self._enableERP5UsersPlugin() self._enableERP5UsersPlugin()
pers = self._createERP5UserPerson('the_user', 'secret') pers = self._createERP5UserPerson('the_user', 'secret')
self._assertUserExists('the_user', 'secret') self._assertUserExists('the_user', 'secret')
person_module_serial = self.portal.person_module._p_serial
self.portal.portal_templates.fixConsistency(filter={'constraint_type': 'post_upgrade'}) self.portal.portal_templates.fixConsistency(filter={'constraint_type': 'post_upgrade'})
self.portal.portal_caches.clearAllCache() self.portal.portal_caches.clearAllCache()
# during migration, old users can still login # during migration, old users can still login
...@@ -792,6 +793,8 @@ class TestMigration(UserManagementTestCase): ...@@ -792,6 +793,8 @@ class TestMigration(UserManagementTestCase):
self._assertUserExists('the_user', 'secret') self._assertUserExists('the_user', 'secret')
return False return False
self.tic(stop_condition=stop_condition) self.tic(stop_condition=stop_condition)
# running this migration did not modify person module
self.assertEqual(self.portal.person_module._p_serial, person_module_serial)
self._assertUserExists('the_user', 'secret') self._assertUserExists('the_user', 'secret')
self.assertEqual(pers.getPassword(), None) self.assertEqual(pers.getPassword(), None)
self.assertEqual(pers.Person_getUserId(), 'the_user') self.assertEqual(pers.Person_getUserId(), 'the_user')
......
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