Commit e874575d authored by Jérome Perrin's avatar Jérome Perrin

Revert "base: ensure migrated persons have a user_id"

This reverts commit bc67c2c4.

This is seem to stall testFunctionalAdvancedECommerce with this error:

      Module script, line 5, in Workflow_ensureUserId
       - <PythonScript at /erp5_portal_7f1517681f85de9695ca475d69c4d66f/portal_workflow/login_interaction_workflow/scripts/Workflow_ensureUserId>
       - Line 5
        user = state_change['object'].getParentValue()
      Module AccessControl.ZopeGuards, line 87, in guarded_getitem
        if getSecurityManager().validate(object, object, None, v):
    Unauthorized: You are not allowed to access '2' in this context

let's revert for now, we'll re-do this with more tests.
parent 5ca4964b
Pipeline #11283 failed with stage
in 0 seconds
......@@ -41,7 +41,7 @@
</chain>
<chain>
<type>ERP5 Login</type>
<workflow>edit_workflow, login_interaction_workflow, login_validation_workflow</workflow>
<workflow>edit_workflow, login_validation_workflow</workflow>
</chain>
<chain>
<type>Email</type>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="InteractionWorkflowDefinition" module="Products.ERP5.InteractionWorkflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>login_interaction_workflow</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interaction" module="Products.ERP5.Interaction"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_mapping</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>interactions</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="InteractionDefinition" module="Products.ERP5.Interaction"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>activate_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>before_commit_script_name</string> </key>
<value>
<list>
<string>Workflow_ensureUserId</string>
</list>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>validate</string>
</list>
</value>
</item>
<item>
<key> <string>once_per_transaction</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type_filter</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>portal_type_group_filter</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>temporary_document_disallowed</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Scripts" module="Products.DCWorkflow.Scripts"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_mapping</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>scripts</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""Make sure the user has a user id.
Persons that were created before user id were introduced may not have a user id already.
"""
user = state_change['object'].getParentValue()
if user.getPortalType() == 'Person' and not user.hasUserId():
user.initUserId()
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </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>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Workflow_ensureUserId</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Variables" module="Products.DCWorkflow.Variables"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_mapping</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>variables</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Worklists" module="Products.DCWorkflow.Worklists"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_mapping</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>worklists</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -22,7 +22,6 @@ Currency | validation_workflow
Delivery Type | base_type_interaction_workflow
Delivery Type | dynamic_class_generation_interaction_workflow
ERP5 Login | edit_workflow
ERP5 Login | login_interaction_workflow
ERP5 Login | login_validation_workflow
Email | coordinate_interaction_workflow
Email | edit_workflow
......
......@@ -9,7 +9,6 @@ document_conversion_interaction_workflow
document_security_interaction_workflow
embedded_workflow
local_permission_interaction_workflow
login_interaction_workflow
login_validation_workflow
movement_resource_interaction_workflow
notification_message_workflow
......
......@@ -5,6 +5,6 @@
</chain>
<chain>
<type>Facebook Login</type>
<workflow>edit_workflow, login_interaction_workflow, validation_workflow</workflow>
<workflow>edit_workflow, validation_workflow</workflow>
</chain>
</workflow_chain>
\ No newline at end of file
Facebook Connector | edit_workflow
Facebook Connector | validation_workflow
Facebook Login | edit_workflow
Facebook Login | login_interaction_workflow
Facebook Login | validation_workflow
\ No newline at end of file
......@@ -5,6 +5,6 @@
</chain>
<chain>
<type>Google Login</type>
<workflow>edit_workflow, login_interaction_workflow, validation_workflow</workflow>
<workflow>edit_workflow, validation_workflow</workflow>
</chain>
</workflow_chain>
\ No newline at end of file
Google Connector | edit_workflow
Google Connector | validation_workflow
Google Login | edit_workflow
Google Login | login_interaction_workflow
Google Login | validation_workflow
\ No newline at end of file
......@@ -887,22 +887,6 @@ class TestMigration(UserManagementTestCase):
self.portal.person_module.newContent,
portal_type='Person',)
def test_NonMigratedPersonCanBecomeUserLater(self):
self._enableERP5UsersPlugin()
non_migrated_person = self.portal.person_module.newContent(
portal_type='Person',
user_id=None,
)
self.tic()
self.portal.portal_templates.fixConsistency(filter={'constraint_type': 'post_upgrade'})
self.tic()
non_migrated_person.newContent(portal_type='Assignment').open()
non_migrated_person.newContent(portal_type='ERP5 Login', reference='login', password='password').validate()
self.tic()
self._assertUserExists('login', 'password')
self.assertTrue(non_migrated_person.getUserId())
class TestUserManagementExternalAuthentication(TestUserManagement):
def getTitle(self):
......
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