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

erp5_oauth_facebook_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 1ec7913b
...@@ -7,5 +7,12 @@ def getAccessTokenFromCode(self, code, redirect_uri): ...@@ -7,5 +7,12 @@ def getAccessTokenFromCode(self, code, redirect_uri):
code=code, redirect_uri=redirect_uri, code=code, redirect_uri=redirect_uri,
app_id=client_id, app_secret=secret_key) app_id=client_id, app_secret=secret_key)
def unrestrictedSearchFacebookConnector(self):
return self.getPortalObject().portal_catalog.unrestrictedSearchResults(
portal_type="Facebook Connector",
reference="default",
validation_state="validated",
limit=2)
def getUserEntry(token): def getUserEntry(token):
return getFacebookUserEntry(token) return getFacebookUserEntry(token)
if REQUEST is not None: if REQUEST is not None:
raise ValueError("This script can't be called in the URL") raise ValueError("This script can't be called in the URL")
result_list = context.getPortalObject().portal_catalog( result_list = context.ERP5Site_getFacebookConnector()
portal_type="Facebook Connector",
reference=reference,
validation_state="validated",
limit=2,
)
assert result_list, "Facebook Connector not found" assert result_list, "Facebook 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>unrestrictedSearchFacebookConnector</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>FacebookLoginUtility</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_getFacebookConnector</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Faceook Connector</string> </value> <value> <string>Facebook Connector</string> </value>
</item> </item>
<item> <item>
<key> <string>unicode_mode</string> </key> <key> <string>unicode_mode</string> </key>
......
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