Commit 2c1c24a9 authored by Rafael Monnerat's avatar Rafael Monnerat

erp5_oauth_google_login: Use unrestrictedSearchResults to avoid security_uid (Speed up)

When a script with manager proxy role is called from anonymous context, it include a HUGE list of security_uids, use unrestrictedSearchResults skips the unecessary usage of security_uids on catalog.
parent 2fecc8e7
......@@ -31,5 +31,12 @@ def getAccessTokenFromCode(self, code, redirect_uri):
credential_data = json.loads(credential.to_json())
return credential_data
def unrestrictedSearchGoogleConnector(self):
return self.getPortalObject().portal_catalog.unrestrictedSearchResults(
portal_type="Google Connector",
reference="default",
validation_state="validated",
limit=2)
def getUserEntry(access_token):
return getGoogleUserEntry(access_token)
\ No newline at end of file
if REQUEST is not None:
raise ValueError("This script can't be called in the URL")
result_list = context.getPortalObject().portal_catalog(
portal_type="Google Connector",
reference=reference,
validation_state="validated",
limit=2,
)
result_list = context.ERP5Site_getGoogleConnector()
assert result_list, "Google Connector not found"
......
<?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>unrestrictedSearchGoogleConnector</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>GoogleLoginUtility</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_getGoogleConnector</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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