Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lukas Niegsch
erp5
Commits
208a3b43
Commit
208a3b43
authored
Jul 07, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
Feat/get google facebook user
See merge request
nexedi/erp5!1177
parents
0baaa9a1
2fb9c425
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
316 additions
and
1 deletion
+316
-1
bt5/erp5_oauth_facebook_login/ExtensionTemplateItem/portal_components/extension.erp5.FacebookLoginUtility.py
.../portal_components/extension.erp5.FacebookLoginUtility.py
+17
-0
bt5/erp5_oauth_facebook_login/SkinTemplateItem/portal_skins/erp5_oauth_facebook_login/ERP5Site_getFacebookConnector.xml
...p5_oauth_facebook_login/ERP5Site_getFacebookConnector.xml
+28
-0
bt5/erp5_oauth_facebook_login/SkinTemplateItem/portal_skins/erp5_oauth_facebook_login/ERP5Site_getFacebookLogin.xml
...s/erp5_oauth_facebook_login/ERP5Site_getFacebookLogin.xml
+28
-0
bt5/erp5_oauth_facebook_login/SkinTemplateItem/portal_skins/erp5_oauth_facebook_login/ERP5Site_getPersonFromFacebookLogin.py
...uth_facebook_login/ERP5Site_getPersonFromFacebookLogin.py
+14
-0
bt5/erp5_oauth_facebook_login/SkinTemplateItem/portal_skins/erp5_oauth_facebook_login/ERP5Site_getPersonFromFacebookLogin.xml
...th_facebook_login/ERP5Site_getPersonFromFacebookLogin.xml
+70
-0
bt5/erp5_oauth_facebook_login/SkinTemplateItem/portal_skins/erp5_oauth_facebook_login/FacebookConnector_view.xml
...kins/erp5_oauth_facebook_login/FacebookConnector_view.xml
+1
-1
bt5/erp5_oauth_google_login/ExtensionTemplateItem/portal_components/extension.erp5.GoogleLoginUtility.py
...em/portal_components/extension.erp5.GoogleLoginUtility.py
+18
-0
bt5/erp5_oauth_google_login/SkinTemplateItem/portal_skins/erp5_oauth_google_login/ERP5Site_getGoogleConnector.xml
...s/erp5_oauth_google_login/ERP5Site_getGoogleConnector.xml
+28
-0
bt5/erp5_oauth_google_login/SkinTemplateItem/portal_skins/erp5_oauth_google_login/ERP5Site_getGoogleLogin.xml
...skins/erp5_oauth_google_login/ERP5Site_getGoogleLogin.xml
+28
-0
bt5/erp5_oauth_google_login/SkinTemplateItem/portal_skins/erp5_oauth_google_login/ERP5Site_getPersonFromGoogleLogin.py
...5_oauth_google_login/ERP5Site_getPersonFromGoogleLogin.py
+14
-0
bt5/erp5_oauth_google_login/SkinTemplateItem/portal_skins/erp5_oauth_google_login/ERP5Site_getPersonFromGoogleLogin.xml
..._oauth_google_login/ERP5Site_getPersonFromGoogleLogin.xml
+70
-0
No files found.
bt5/erp5_oauth_facebook_login/ExtensionTemplateItem/portal_components/extension.erp5.FacebookLoginUtility.py
View file @
208a3b43
...
@@ -2,6 +2,7 @@ import facebook
...
@@ -2,6 +2,7 @@ import facebook
from
ZTUtils
import
make_query
from
ZTUtils
import
make_query
from
Products.ERP5Security.ERP5ExternalOauth2ExtractionPlugin
import
getFacebookUserEntry
from
Products.ERP5Security.ERP5ExternalOauth2ExtractionPlugin
import
getFacebookUserEntry
from
zExceptions
import
Unauthorized
def
_getFacebookClientIdAndSecretKey
(
portal
,
reference
=
"default"
):
def
_getFacebookClientIdAndSecretKey
(
portal
,
reference
=
"default"
):
"""Returns facebook client id and secret key.
"""Returns facebook client id and secret key.
...
@@ -37,5 +38,21 @@ def getAccessTokenFromCode(self, code, redirect_uri):
...
@@ -37,5 +38,21 @@ 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
unrestrictedSearchFacebookLogin
(
self
,
login
,
REQUEST
=
None
):
if
REQUEST
is
not
None
:
raise
Unauthorized
return
self
.
getPortalObject
().
portal_catalog
.
unrestrictedSearchResults
(
portal_type
=
"Facebook Login"
,
reference
=
login
,
validation_state
=
"validated"
,
limit
=
1
)
def
getUserEntry
(
token
):
def
getUserEntry
(
token
):
return
getFacebookUserEntry
(
token
)
return
getFacebookUserEntry
(
token
)
bt5/erp5_oauth_facebook_login/SkinTemplateItem/portal_skins/erp5_oauth_facebook_login/ERP5Site_getFacebookConnector.xml
0 → 100644
View file @
208a3b43
<?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>
bt5/erp5_oauth_facebook_login/SkinTemplateItem/portal_skins/erp5_oauth_facebook_login/ERP5Site_getFacebookLogin.xml
0 → 100644
View file @
208a3b43
<?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>
unrestrictedSearchFacebookLogin
</string>
</value>
</item>
<item>
<key>
<string>
_module
</string>
</key>
<value>
<string>
FacebookLoginUtility
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Site_getFacebookLogin
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_oauth_facebook_login/SkinTemplateItem/portal_skins/erp5_oauth_facebook_login/ERP5Site_getPersonFromFacebookLogin.py
0 → 100644
View file @
208a3b43
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
login
=
context
.
ERP5Site_getFacebookLogin
(
login
)
if
login
is
None
:
return
login
if
len
(
login
)
>
1
:
raise
ValueError
(
"Duplicated User"
)
return
login
[
0
].
getParentValue
().
getRelativeUrl
()
bt5/erp5_oauth_facebook_login/SkinTemplateItem/portal_skins/erp5_oauth_facebook_login/ERP5Site_getPersonFromFacebookLogin.xml
0 → 100644
View file @
208a3b43
<?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>
login, REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Site_getPersonFromFacebookLogin
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_oauth_facebook_login/SkinTemplateItem/portal_skins/erp5_oauth_facebook_login/FacebookConnector_view.xml
View file @
208a3b43
...
@@ -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>
Face
b
ook Connector
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
unicode_mode
</string>
</key>
<key>
<string>
unicode_mode
</string>
</key>
...
...
bt5/erp5_oauth_google_login/ExtensionTemplateItem/portal_components/extension.erp5.GoogleLoginUtility.py
View file @
208a3b43
import
json
import
json
import
oauth2client.client
import
oauth2client.client
from
Products.ERP5Security.ERP5ExternalOauth2ExtractionPlugin
import
getGoogleUserEntry
from
Products.ERP5Security.ERP5ExternalOauth2ExtractionPlugin
import
getGoogleUserEntry
from
zExceptions
import
Unauthorized
SCOPE_LIST
=
[
'https://www.googleapis.com/auth/userinfo.profile'
,
SCOPE_LIST
=
[
'https://www.googleapis.com/auth/userinfo.profile'
,
'https://www.googleapis.com/auth/userinfo.email'
]
'https://www.googleapis.com/auth/userinfo.email'
]
...
@@ -49,5 +51,21 @@ def getAccessTokenFromCode(self, code, redirect_uri):
...
@@ -49,5 +51,21 @@ def getAccessTokenFromCode(self, code, redirect_uri):
credential_data
=
json
.
loads
(
credential
.
to_json
())
credential_data
=
json
.
loads
(
credential
.
to_json
())
return
credential_data
return
credential_data
def
unrestrictedSearchGoogleConnector
(
self
):
return
self
.
getPortalObject
().
portal_catalog
.
unrestrictedSearchResults
(
portal_type
=
"Google Connector"
,
reference
=
"default"
,
validation_state
=
"validated"
,
limit
=
2
)
def
unrestrictedSearchGoogleLogin
(
self
,
login
,
REQUEST
=
None
):
if
REQUEST
is
not
None
:
raise
Unauthorized
return
self
.
getPortalObject
().
portal_catalog
.
unrestrictedSearchResults
(
portal_type
=
"Google Login"
,
reference
=
login
,
validation_state
=
"validated"
,
limit
=
1
)
def
getUserEntry
(
access_token
):
def
getUserEntry
(
access_token
):
return
getGoogleUserEntry
(
access_token
)
return
getGoogleUserEntry
(
access_token
)
\ No newline at end of file
bt5/erp5_oauth_google_login/SkinTemplateItem/portal_skins/erp5_oauth_google_login/ERP5Site_getGoogleConnector.xml
0 → 100644
View file @
208a3b43
<?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>
bt5/erp5_oauth_google_login/SkinTemplateItem/portal_skins/erp5_oauth_google_login/ERP5Site_getGoogleLogin.xml
0 → 100644
View file @
208a3b43
<?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_getGoogleLogin
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_oauth_google_login/SkinTemplateItem/portal_skins/erp5_oauth_google_login/ERP5Site_getPersonFromGoogleLogin.py
0 → 100644
View file @
208a3b43
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
login
=
context
.
ERP5Site_getGoogleLogin
(
login
)
if
login
is
None
:
return
login
if
len
(
login
)
>
1
:
raise
ValueError
(
"Duplicated User"
)
return
login
[
0
].
getParentValue
().
getRelativeUrl
()
bt5/erp5_oauth_google_login/SkinTemplateItem/portal_skins/erp5_oauth_google_login/ERP5Site_getPersonFromGoogleLogin.xml
0 → 100644
View file @
208a3b43
<?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>
login, REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Site_getPersonFromGoogleLogin
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment