Commit 8a27134c authored by Jérome Perrin's avatar Jérome Perrin

Enable erp5 login user manager in post_upgrade

I just simulated an upgrade for an ERP5 running a version from before !185,  `ERP5UserManager Non Existence_constraint` properly disabled old `acl_users/erp5_users` and migrated all persons, but  `ERP5UserLoginManager Existence_constraint` did not activate `acl_users/erp5_login_users`.

This is because  `ERP5UserLoginManager Existence_constraint` is registered as a **pre-upgrade** constraint, but with my upgrade scenario, pre-upgrade constraint are installed too late. 

The upgrade scenario was:

 1. install new ERP5 SR on slapos
 2. manually install new versions of  erp5_upgrader and customer_configuration_upgrader business template
 3. run upgrade ( sense then fix on portal_alarms/promise_check_upgrade )

During step 3, when pre-upgrade constraints are executed, erp5_base is not installed yet, so  `ERP5UserLoginManager Existence_constraint` can not run because it's not installed yet. 

My suggestion is to change it to a post-upgrade constraint.

If I understand correctly and my upgrade scenario is really the supported one, it means we can only have pre-upgrade constraints in erp5_upgrader.

( I also fix a meaningless typo in the same code)

/cc @kazuhiko  @vpelletier @seb @gabriel 

/reviewed-on nexedi/erp5!262
parents e5e64ca5 3aaefab3
......@@ -22,7 +22,7 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>constraint_type/pre_upgrade</string>
<string>constraint_type/post_upgrade</string>
</tuple>
</value>
</item>
......@@ -34,7 +34,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5LoginUserNamager Existence_constraint</string> </value>
<value> <string>ERP5LoginUserManager Existence_constraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......
......@@ -34,7 +34,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5UserNamager Non Existence_constraint</string> </value>
<value> <string>ERP5UserManager Non Existence_constraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......
......@@ -484,11 +484,11 @@ class TestUserManagement(ERP5TypeTestCase):
acl_users= self.portal.acl_users
acl_users.manage_delObjects(ids=['erp5_login_users'])
portal_templates = self.portal.portal_templates
self.assertNotEqual(portal_templates.checkConsistency(filter={'constraint_type': 'pre_upgrade'}) , [])
self.assertNotEqual(portal_templates.checkConsistency(filter={'constraint_type': 'post_upgrade'}) , [])
# call checkConsistency again to check if FIX does not happen by checkConsistency().
self.assertNotEqual(portal_templates.checkConsistency(filter={'constraint_type': 'pre_upgrade'}) , [])
portal_templates.fixConsistency(filter={'constraint_type': 'pre_upgrade'})
self.assertEqual(portal_templates.checkConsistency(filter={'constraint_type': 'pre_upgrade'}) , [])
self.assertNotEqual(portal_templates.checkConsistency(filter={'constraint_type': 'post_upgrade'}) , [])
portal_templates.fixConsistency(filter={'constraint_type': 'post_upgrade'})
self.assertEqual(portal_templates.checkConsistency(filter={'constraint_type': 'post_upgrade'}) , [])
self.assertTrue('erp5_login_users' in \
[x[0] for x in self.portal.acl_users.plugins.listPlugins(IAuthenticationPlugin)])
self.assertTrue('erp5_login_users' in \
......
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