Login in ERP5 with Google Account
This branch is a fork of allow_login_change and contains the feature to login in ERP5 with Google Account plus business templates migrated to the new format.
Feel free to review @cedric.leninivin @kazuhiko
I tried to add a script that creates automatically through upgrader, the ERP5 Google Extraction Plugin and enable it. But, this plugin only works if created manually. Any idea?
## Script (Python) "ERP5Site_setupGoogleLoginAccessTokenExtraction"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=fixit=False
##title=
##
token_extraction_id = "google_access_token_plugin"
pas = context.getPortalObject().acl_users
access_extraction_list = [q for q in pas.objectValues() \
if q.meta_type == 'ERP5 Google Extraction Plugin']
assert len(access_extraction_list) <= 1, "More than one found %s" % access_extraction_list
result_list = []
if not access_extraction_list:
# See https://github.com/Nexedi/erp5/commit/0bee523da0075c6efe3c06296dddd01d9dd5045a
# a dump http extraction plugin is required as fallback if we use an access token
if 'erp5_dumb_http_extraction' not in pas.objectIds():
if fixit:
dispacher = pas.manage_addProduct['ERP5Security']
dispacher.addERP5DumbHTTPExtractionPlugin('erp5_dumb_http_extraction')
pas.erp5_dumb_http_extraction.manage_activateInterfaces(('IExtractionPlugin', ))
result_list.append('erp5_dumb_http_extraction created')
else:
result_list.append('erp5_dumb_http_extraction is required')
if fixit:
dispacher = pas.manage_addProduct['ERP5Security']
dispacher.addERP5AccessTokenExtractionPlugin(token_extraction_id)
getattr(pas, token_extraction_id).manage_activateInterfaces(('IExtractionPlugin',))
result_list.append('%s created' % token_extraction_id)
else:
result_list.append('%s is required' % token_extraction_id)
return result_list