Commit 01cd3f06 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_erp5: Subscription dont handle user creation anymore

   ... we dont require to create and use the user under the same transaction anymore.
parent f1aae5d7
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from zExceptions import Unauthorized
def SubscriptionRequest_saveTransactionalUser(self, person=None):
if person.getPortalType() == "Person":
getTransactionalVariable()["transactional_user"] = person
return person
def SubscriptionRequest_getTransactionalUser(self, REQUEST=None):
if REQUEST is not None:
raise Unauthorized
return getTransactionalVariable().get("transactional_user", None)
def SubscriptionRequest_searchExistingUserByEmail(self, email, REQUEST=None):
if REQUEST is not None:
raise Unauthorized
portal = self.getPortalObject()
if email in ["", None]:
return
erp5_login_list = portal.portal_catalog.unrestrictedSearchResults(
portal_type="ERP5 Login",
reference=email,
validation_state="validated")
if len(erp5_login_list):
return erp5_login_list[0].getParentValue()
# Already has login with this.
person_list = portal.portal_catalog.unrestrictedSearchResults(
portal_type="Person",
default_email_text=email,
validation_state="validated")
if len(person_list):
return person_list[0].getObject()
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Extension Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>SlapOSSubscriptionRequest</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>extension.erp5.SlapOSSubscriptionRequest</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Extension Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>SubscriptionRequest_getTransactionalUser</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>SlapOSSubscriptionRequest</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SubscriptionRequest_getTransactionalUser</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>SubscriptionRequest_saveTransactionalUser</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>SlapOSSubscriptionRequest</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SubscriptionRequest_saveTransactionalUser</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>SubscriptionRequest_searchExistingUserByEmail</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>SlapOSSubscriptionRequest</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SubscriptionRequest_searchExistingUserByEmail</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
extension.erp5.SlapOSSubscriptionRequest
\ No newline at end of file
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