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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
41b29254
Commit
41b29254
authored
Aug 29, 2018
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_access_token_hal] Generate dummy token to access hal from a jio device
parent
3e889a76
Changes
31
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
1256 additions
and
0 deletions
+1256
-0
bt5/erp5_access_token_hal/ActionTemplateItem/portal_types/HAL%20Access%20Token/view.xml
...onTemplateItem/portal_types/HAL%20Access%20Token/view.xml
+85
-0
bt5/erp5_access_token_hal/ExtensionTemplateItem/portal_components/extension.erp5.AccessTokenHal.py
...teItem/portal_components/extension.erp5.AccessTokenHal.py
+5
-0
bt5/erp5_access_token_hal/ExtensionTemplateItem/portal_components/extension.erp5.AccessTokenHal.xml
...eItem/portal_components/extension.erp5.AccessTokenHal.xml
+123
-0
bt5/erp5_access_token_hal/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml
...eAllowedContentTypeTemplateItem/allowed_content_types.xml
+5
-0
bt5/erp5_access_token_hal/PortalTypeBaseCategoryTemplateItem/base_category_list.xml
...PortalTypeBaseCategoryTemplateItem/base_category_list.xml
+5
-0
bt5/erp5_access_token_hal/PortalTypeTemplateItem/portal_types/HAL%20Access%20Token.xml
...talTypeTemplateItem/portal_types/HAL%20Access%20Token.xml
+64
-0
bt5/erp5_access_token_hal/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
...rtalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
+6
-0
bt5/erp5_access_token_hal/SkinTemplateItem/portal_skins/erp5_access_token_hal.xml
...l/SkinTemplateItem/portal_skins/erp5_access_token_hal.xml
+26
-0
bt5/erp5_access_token_hal/SkinTemplateItem/portal_skins/erp5_access_token_hal/Base_generateAccessTokenHalID.xml
...s/erp5_access_token_hal/Base_generateAccessTokenHalID.xml
+28
-0
bt5/erp5_access_token_hal/SkinTemplateItem/portal_skins/erp5_access_token_hal/HALAccessToken_getExternalLogin.py
.../erp5_access_token_hal/HALAccessToken_getExternalLogin.py
+19
-0
bt5/erp5_access_token_hal/SkinTemplateItem/portal_skins/erp5_access_token_hal/HALAccessToken_getExternalLogin.xml
...erp5_access_token_hal/HALAccessToken_getExternalLogin.xml
+62
-0
bt5/erp5_access_token_hal/SkinTemplateItem/portal_skins/erp5_access_token_hal/HALAccessToken_view.xml
...ortal_skins/erp5_access_token_hal/HALAccessToken_view.xml
+155
-0
bt5/erp5_access_token_hal/SkinTemplateItem/portal_skins/erp5_access_token_hal/HALAccessToken_view/my_agent_title.xml
...5_access_token_hal/HALAccessToken_view/my_agent_title.xml
+96
-0
bt5/erp5_access_token_hal/SkinTemplateItem/portal_skins/erp5_access_token_hal/HALAccessToken_view/my_id.xml
...skins/erp5_access_token_hal/HALAccessToken_view/my_id.xml
+78
-0
bt5/erp5_access_token_hal/SkinTemplateItem/portal_skins/erp5_access_token_hal/HALAccessToken_view/my_translated_validation_state_title.xml
...AccessToken_view/my_translated_validation_state_title.xml
+90
-0
bt5/erp5_access_token_hal/SkinTemplateItem/portal_skins/erp5_access_token_hal/Person_createHALAccessToken.py
...kins/erp5_access_token_hal/Person_createHALAccessToken.py
+10
-0
bt5/erp5_access_token_hal/SkinTemplateItem/portal_skins/erp5_access_token_hal/Person_createHALAccessToken.xml
...ins/erp5_access_token_hal/Person_createHALAccessToken.xml
+62
-0
bt5/erp5_access_token_hal/TestTemplateItem/portal_components/test.erp5.testERP5TokenLogin.py
...ateItem/portal_components/test.erp5.testERP5TokenLogin.py
+183
-0
bt5/erp5_access_token_hal/TestTemplateItem/portal_components/test.erp5.testERP5TokenLogin.xml
...teItem/portal_components/test.erp5.testERP5TokenLogin.xml
+140
-0
bt5/erp5_access_token_hal/bt/dependency_list
bt5/erp5_access_token_hal/bt/dependency_list
+1
-0
bt5/erp5_access_token_hal/bt/template_action_path_list
bt5/erp5_access_token_hal/bt/template_action_path_list
+1
-0
bt5/erp5_access_token_hal/bt/template_extension_id_list
bt5/erp5_access_token_hal/bt/template_extension_id_list
+1
-0
bt5/erp5_access_token_hal/bt/template_format_version
bt5/erp5_access_token_hal/bt/template_format_version
+1
-0
bt5/erp5_access_token_hal/bt/template_portal_type_allowed_content_type_list
...ken_hal/bt/template_portal_type_allowed_content_type_list
+1
-0
bt5/erp5_access_token_hal/bt/template_portal_type_base_category_list
...cess_token_hal/bt/template_portal_type_base_category_list
+1
-0
bt5/erp5_access_token_hal/bt/template_portal_type_id_list
bt5/erp5_access_token_hal/bt/template_portal_type_id_list
+1
-0
bt5/erp5_access_token_hal/bt/template_portal_type_workflow_chain_list
...ess_token_hal/bt/template_portal_type_workflow_chain_list
+2
-0
bt5/erp5_access_token_hal/bt/template_skin_id_list
bt5/erp5_access_token_hal/bt/template_skin_id_list
+1
-0
bt5/erp5_access_token_hal/bt/template_test_id_list
bt5/erp5_access_token_hal/bt/template_test_id_list
+1
-0
bt5/erp5_access_token_hal/bt/test_dependency_list
bt5/erp5_access_token_hal/bt/test_dependency_list
+2
-0
bt5/erp5_access_token_hal/bt/title
bt5/erp5_access_token_hal/bt/title
+1
-0
No files found.
bt5/erp5_access_token_hal/ActionTemplateItem/portal_types/HAL%20Access%20Token/view.xml
0 → 100644
View file @
41b29254
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ActionInformation"
module=
"Products.CMFCore.ActionInformation"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
action_type/object_view
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
category
</string>
</key>
<value>
<string>
object_view
</string>
</value>
</item>
<item>
<key>
<string>
condition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
icon
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
view
</string>
</value>
</item>
<item>
<key>
<string>
permissions
</string>
</key>
<value>
<tuple>
<string>
View
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Action Information
</string>
</value>
</item>
<item>
<key>
<string>
priority
</string>
</key>
<value>
<float>
1.0
</float>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
View
</string>
</value>
</item>
<item>
<key>
<string>
visible
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Expression"
module=
"Products.CMFCore.Expression"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
text
</string>
</key>
<value>
<string>
string:${object_url}/HALAccessToken_view
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_access_token_hal/ExtensionTemplateItem/portal_components/extension.erp5.AccessTokenHal.py
0 → 100644
View file @
41b29254
import
os
import
hashlib
def
generateSecretKey
(
self
,
length
=
128
):
return
hashlib
.
sha1
(
os
.
urandom
(
length
)).
hexdigest
()
bt5/erp5_access_token_hal/ExtensionTemplateItem/portal_components/extension.erp5.AccessTokenHal.xml
0 → 100644
View file @
41b29254
<?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>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
AccessTokenHal
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
extension.erp5.AccessTokenHal
</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"
>
AAAAAAAAAAM=
</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/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<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"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
<pickle>
<tuple>
<none/>
<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>
</tuple>
</pickle>
</record>
</ZopeData>
bt5/erp5_access_token_hal/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml
0 → 100644
View file @
41b29254
<allowed_content_type_list>
<portal_type
id=
"Access Token Module"
>
<item>
HAL Access Token
</item>
</portal_type>
</allowed_content_type_list>
\ No newline at end of file
bt5/erp5_access_token_hal/PortalTypeBaseCategoryTemplateItem/base_category_list.xml
0 → 100644
View file @
41b29254
<base_category_list>
<portal_type
id=
"HAL Access Token"
>
<item>
agent
</item>
</portal_type>
</base_category_list>
\ No newline at end of file
bt5/erp5_access_token_hal/PortalTypeTemplateItem/portal_types/HAL%20Access%20Token.xml
0 → 100644
View file @
41b29254
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Base Type"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
content_icon
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
factory
</string>
</key>
<value>
<string>
addXMLObject
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
HAL Access Token
</string>
</value>
</item>
<item>
<key>
<string>
init_script
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
permission
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Base Type
</string>
</value>
</item>
<item>
<key>
<string>
type_class
</string>
</key>
<value>
<string>
XMLObject
</string>
</value>
</item>
<item>
<key>
<string>
type_interface
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
type_mixin
</string>
</key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_access_token_hal/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
0 → 100644
View file @
41b29254
<workflow_chain>
<chain>
<type>
HAL Access Token
</type>
<workflow>
edit_workflow, validation_workflow
</workflow>
</chain>
</workflow_chain>
\ No newline at end of file
bt5/erp5_access_token_hal/SkinTemplateItem/portal_skins/erp5_access_token_hal.xml
0 → 100644
View file @
41b29254
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Folder"
module=
"OFS.Folder"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_objects
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
erp5_access_token_hal
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_access_token_hal/SkinTemplateItem/portal_skins/erp5_access_token_hal/Base_generateAccessTokenHalID.xml
0 → 100644
View file @
41b29254
<?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>
generateSecretKey
</string>
</value>
</item>
<item>
<key>
<string>
_module
</string>
</key>
<value>
<string>
AccessTokenHal
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_generateAccessTokenHalID
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_access_token_hal/SkinTemplateItem/portal_skins/erp5_access_token_hal/HALAccessToken_getExternalLogin.py
0 → 100644
View file @
41b29254
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
result
=
None
,
None
access_token_document
=
context
request
=
context
.
REQUEST
portal
=
context
.
getPortalObject
()
if
access_token_document
.
getValidationState
()
==
'validated'
:
if
(
portal
.
portal_skins
.
getCurrentSkinName
()
==
'HalRestricted'
):
agent_document
=
access_token_document
.
getAgentValue
()
if
agent_document
is
not
None
:
for
erp5_login
in
agent_document
.
objectValues
(
portal
.
getPortalLoginTypeList
()):
if
erp5_login
.
getValidationState
()
==
"validated"
:
result
=
erp5_login
.
getReference
(),
erp5_login
.
getPortalType
()
return
result
bt5/erp5_access_token_hal/SkinTemplateItem/portal_skins/erp5_access_token_hal/HALAccessToken_getExternalLogin.xml
0 → 100644
View file @
41b29254
<?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>
REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
HALAccessToken_getExternalLogin
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_access_token_hal/SkinTemplateItem/portal_skins/erp5_access_token_hal/HALAccessToken_view.xml
0 → 100644
View file @
41b29254
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ERP5 Form"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_objects
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
Base_edit
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
edit_order
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
encoding
</string>
</key>
<value>
<string>
UTF-8
</string>
</value>
</item>
<item>
<key>
<string>
enctype
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
group_list
</string>
</key>
<value>
<list>
<string>
left
</string>
<string>
right
</string>
<string>
center
</string>
<string>
bottom
</string>
<string>
hidden
</string>
</list>
</value>
</item>
<item>
<key>
<string>
groups
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
bottom
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
center
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
left
</string>
</key>
<value>
<list>
<string>
my_id
</string>
<string>
my_agent_title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
right
</string>
</key>
<value>
<list>
<string>
my_translated_validation_state_title
</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
HALAccessToken_view
</string>
</value>
</item>
<item>
<key>
<string>
method
</string>
</key>
<value>
<string>
POST
</string>
</value>
</item>
<item>
<key>
<string>
name
</string>
</key>
<value>
<string>
AccessToken_view
</string>
</value>
</item>
<item>
<key>
<string>
pt
</string>
</key>
<value>
<string>
form_view
</string>
</value>
</item>
<item>
<key>
<string>
row_length
</string>
</key>
<value>
<int>
4
</int>
</value>
</item>
<item>
<key>
<string>
stored_encoding
</string>
</key>
<value>
<string>
UTF-8
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Access Token
</string>
</value>
</item>
<item>
<key>
<string>
unicode_mode
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
update_action
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
update_action_title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_access_token_hal/SkinTemplateItem/portal_skins/erp5_access_token_hal/HALAccessToken_view/my_agent_title.xml
0 → 100644
View file @
41b29254
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
portal_type
</string>
<string>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_agent_title
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_relation_field
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<list>
<tuple>
<string>
Person
</string>
<string>
Person
</string>
</tuple>
</list>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
User
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_access_token_hal/SkinTemplateItem/portal_skins/erp5_access_token_hal/HALAccessToken_view/my_id.xml
0 → 100644
View file @
41b29254
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_id
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_view_mode_read_only_id
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_access_token_hal/SkinTemplateItem/portal_skins/erp5_access_token_hal/HALAccessToken_view/my_translated_validation_state_title.xml
0 → 100644
View file @
41b29254
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_translated_validation_state_title
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_translated_workflow_state_title
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_access_token_hal/SkinTemplateItem/portal_skins/erp5_access_token_hal/Person_createHALAccessToken.py
0 → 100644
View file @
41b29254
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
token
=
portal
.
access_token_module
.
newContent
(
id
=
'%s-%s'
%
(
DateTime
().
strftime
(
'%Y%m%d'
),
portal
.
Base_generateAccessTokenHalID
()),
portal_type
=
'HAL Access Token'
,
agent_value
=
context
)
token
.
validate
()
return
token
bt5/erp5_access_token_hal/SkinTemplateItem/portal_skins/erp5_access_token_hal/Person_createHALAccessToken.xml
0 → 100644
View file @
41b29254
<?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></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Person_createHALAccessToken
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_access_token_hal/TestTemplateItem/portal_components/test.erp5.testERP5TokenLogin.py
0 → 100644
View file @
41b29254
##############################################################################
#
# Copyright (c) 2008 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
import
uuid
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
ACCESS_TOKEN
=
"EAAF10h0gIiQZDZD"
def
getUserId
(
access_token
):
return
"1234567890123456"
def
getAccessTokenFromCode
(
code
,
redirect_uri
):
assert
code
==
CODE
,
"Invalid code"
# This is an example of a Facebook response
return
{
u'access_token'
:
u'EAAF10h0gIiQZDZD'
,
u'token_type'
:
u'bearer'
,
u'expires_in'
:
5138578
}
def
getUserEntry
(
access_token
):
return
{
'name'
:
'John Doe'
,
'reference'
:
getUserId
(
None
),
'email'
:
"dummy@example.org"
}
FacebookLoginUtility_getAccessTokenFromCode
=
FacebookLoginUtility
.
getAccessTokenFromCode
FacebookLoginUtility_getUserEntry
=
FacebookLoginUtility
.
getUserEntry
class
TestFacebookLogin
(
ERP5TypeTestCase
):
def
getTitle
(
self
):
return
"Test Facebook Login"
def
beforeTearDown
(
self
):
FacebookLoginUtility
.
getAccessTokenFromCode
=
FacebookLoginUtility_getAccessTokenFromCode
FacebookLoginUtility
.
getUserEntry
=
FacebookLoginUtility_getUserEntry
def
afterSetUp
(
self
):
"""
This is ran before anything, used to set the environment
"""
self
.
login
()
self
.
portal
.
TemplateTool_checkFacebookExtractionPluginExistenceConsistency
(
fixit
=
True
)
# Patch extension to avoid external connection
FacebookLoginUtility
.
getUserId
=
getUserId
FacebookLoginUtility
.
getAccessTokenFromCode
=
getAccessTokenFromCode
FacebookLoginUtility
.
getUserEntry
=
getUserEntry
self
.
dummy_connector_id
=
"test_facebook_connector"
person_module
=
self
.
portal
.
person_module
portal_catalog
=
self
.
portal
.
portal_catalog
for
obj
in
portal_catalog
(
portal_type
=
[
"Facebook Login"
,
"Person"
],
reference
=
getUserId
(
None
),
validation_state
=
"validated"
):
obj
.
getObject
().
invalidate
()
uuid_str
=
uuid
.
uuid4
().
hex
obj
.
setReference
(
uuid_str
)
obj
.
setUserId
(
uuid_str
)
for
connector
in
portal_catalog
(
portal_type
=
"Facebook Connector"
,
validation_state
=
"validated"
,
id
=
"NOT %s"
%
self
.
dummy_connector_id
,
reference
=
"default"
):
connector
.
invalidate
()
if
getattr
(
self
.
portal
.
portal_oauth
,
self
.
dummy_connector_id
,
None
)
is
None
:
connector
=
self
.
portal
.
portal_oauth
.
newContent
(
id
=
self
.
dummy_connector_id
,
portal_type
=
"Facebook Connector"
,
reference
=
"default"
,
client_id
=
CLIENT_ID
,
secret_key
=
SECRET_KEY
)
connector
.
validate
()
self
.
tic
()
self
.
logout
()
def
test_redirect
(
self
):
"""
Check URL generate to redirect to Facebook
"""
self
.
logout
()
self
.
portal
.
ERP5Site_redirectToFacebookLoginPage
()
location
=
self
.
portal
.
REQUEST
.
RESPONSE
.
getHeader
(
"Location"
)
self
.
assertIn
(
"https://www.facebook.com/v2.10/dialog/oauth?"
,
location
)
self
.
assertIn
(
"scope=email&redirect_uri="
,
location
)
self
.
assertIn
(
"client_id=%s"
%
CLIENT_ID
,
location
)
self
.
assertNotIn
(
"secret_key="
,
location
)
self
.
assertIn
(
"ERP5Site_callbackFacebookLogin"
,
location
)
def
test_create_user_in_ERP5Site_createFacebookUserToOAuth
(
self
):
"""
Check if ERP5 set cookie properly after receive code from external service
"""
self
.
login
()
id_list
=
[]
for
result
in
self
.
portal
.
portal_catalog
(
portal_type
=
"Credential Request"
,
reference
=
getUserId
(
None
)):
id_list
.
append
(
result
.
getObject
().
getId
())
self
.
portal
.
credential_request_module
.
manage_delObjects
(
ids
=
id_list
)
skin
=
self
.
portal
.
portal_skins
.
custom
createZODBPythonScript
(
skin
,
"CredentialRequest_createUser"
,
""
,
"""
person = context.getDestinationDecisionValue(portal_type="Person")
login_list = [x for x in person.objectValues(portal_type='Facebook Login')
\
if x.getValidationState() == 'validated']
if len(login_list):
login = login_list[0]
else:
login = person.newContent(portal_type='Facebook Login')
reference = context.getReference()
if not login.hasReference():
if not reference:
raise ValueError("Impossible to create an account without login")
login.setReference(reference)
if not person.Person_getUserId():
person.setUserId(reference)
if login.getValidationState() == 'draft':
login.validate()
return reference, None
"""
)
createZODBPythonScript
(
skin
,
"ERP5Site_createFacebookUserToOAuth"
,
"user_reference, user_dict"
,
"""
module = context.getPortalObject().getDefaultModule(portal_type='Credential Request')
credential_request = module.newContent(
portal_type="Credential Request",
first_name=user_dict["name"],
reference=user_reference,
default_email_text=user_dict["email"],
)
credential_request.submit()
context.portal_alarms.accept_submitted_credentials.activeSense()
return credential_request
"""
)
self
.
logout
()
response
=
self
.
portal
.
ERP5Site_callbackFacebookLogin
(
code
=
CODE
)
facebook_hash
=
self
.
portal
.
REQUEST
.
RESPONSE
.
cookies
.
get
(
"__ac_facebook_hash"
)[
"value"
]
self
.
assertEqual
(
"8cec04e21e927f1023f4f4980ec11a77"
,
facebook_hash
)
self
.
assertEqual
(
self
.
portal
.
absolute_url
(),
response
)
cache_dict
=
self
.
portal
.
Base_getBearerToken
(
facebook_hash
,
"facebook_server_auth_token_cache_factory"
)
self
.
assertEqual
(
ACCESS_TOKEN
,
cache_dict
[
"access_token"
])
self
.
assertEqual
({
'reference'
:
getUserId
(
None
)},
self
.
portal
.
Base_getBearerToken
(
ACCESS_TOKEN
,
"facebook_server_auth_token_cache_factory"
)
)
self
.
portal
.
REQUEST
[
"__ac_facebook_hash"
]
=
facebook_hash
erp5_facebook_extractor
=
self
.
portal
.
acl_users
.
erp5_facebook_extraction
self
.
assertEqual
({
'external_login'
:
getUserId
(
None
),
'login_portal_type'
:
'Facebook Login'
,
'remote_host'
:
''
,
'remote_address'
:
''
},
erp5_facebook_extractor
.
extractCredentials
(
self
.
portal
.
REQUEST
))
self
.
tic
()
self
.
login
()
credential_request
=
self
.
portal
.
portal_catalog
(
portal_type
=
"Credential Request"
,
reference
=
getUserId
(
None
))[
0
].
getObject
()
if
credential_request
.
getValidationState
()
!=
"accepted"
:
credential_request
.
accept
()
person
=
credential_request
.
getDestinationDecisionValue
()
facebook_login
=
person
.
objectValues
(
portal_types
=
"Facebook Login"
)[
0
]
self
.
assertEqual
(
getUserId
(
None
),
facebook_login
.
getReference
())
bt5/erp5_access_token_hal/TestTemplateItem/portal_components/test.erp5.testERP5TokenLogin.xml
0 → 100644
View file @
41b29254
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Test Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testERP5TokenLogin
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testERP5TokenLogin
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Test 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>
<string>
E: 38, 17: Undefined variable \'CODE\' (undefined-variable)
</string>
<string>
E: 49, 46: Undefined variable \'FacebookLoginUtility\' (undefined-variable)
</string>
<string>
E: 50, 36: Undefined variable \'FacebookLoginUtility\' (undefined-variable)
</string>
<string>
E: 58, 4: Undefined variable \'FacebookLoginUtility\' (undefined-variable)
</string>
<string>
E: 59, 4: Undefined variable \'FacebookLoginUtility\' (undefined-variable)
</string>
<string>
E: 68, 4: Undefined variable \'FacebookLoginUtility\' (undefined-variable)
</string>
<string>
E: 69, 4: Undefined variable \'FacebookLoginUtility\' (undefined-variable)
</string>
<string>
E: 70, 4: Undefined variable \'FacebookLoginUtility\' (undefined-variable)
</string>
<string>
E: 92, 64: Undefined variable \'CLIENT_ID\' (undefined-variable)
</string>
<string>
E: 93, 65: Undefined variable \'SECRET_KEY\' (undefined-variable)
</string>
<string>
E:107, 35: Undefined variable \'CLIENT_ID\' (undefined-variable)
</string>
<string>
E:160, 63: Undefined variable \'CODE\' (undefined-variable)
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 73, 4: Unused variable \'person_module\' (unused-variable)
</string>
</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"
>
AAAAAAAAAAM=
</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/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<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"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
draft
</string>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
bt5/erp5_access_token_hal/bt/dependency_list
0 → 100644
View file @
41b29254
erp5_access_token
\ No newline at end of file
bt5/erp5_access_token_hal/bt/template_action_path_list
0 → 100644
View file @
41b29254
HAL Access Token | view
\ No newline at end of file
bt5/erp5_access_token_hal/bt/template_extension_id_list
0 → 100644
View file @
41b29254
extension.erp5.AccessTokenHal
\ No newline at end of file
bt5/erp5_access_token_hal/bt/template_format_version
0 → 100644
View file @
41b29254
1
\ No newline at end of file
bt5/erp5_access_token_hal/bt/template_portal_type_allowed_content_type_list
0 → 100644
View file @
41b29254
Access Token Module | HAL Access Token
\ No newline at end of file
bt5/erp5_access_token_hal/bt/template_portal_type_base_category_list
0 → 100644
View file @
41b29254
HAL Access Token | agent
\ No newline at end of file
bt5/erp5_access_token_hal/bt/template_portal_type_id_list
0 → 100644
View file @
41b29254
HAL Access Token
\ No newline at end of file
bt5/erp5_access_token_hal/bt/template_portal_type_workflow_chain_list
0 → 100644
View file @
41b29254
HAL Access Token | edit_workflow
HAL Access Token | validation_workflow
\ No newline at end of file
bt5/erp5_access_token_hal/bt/template_skin_id_list
0 → 100644
View file @
41b29254
erp5_access_token_hal
\ No newline at end of file
bt5/erp5_access_token_hal/bt/template_test_id_list
0 → 100644
View file @
41b29254
test.erp5.testERP5TokenLogin
\ No newline at end of file
bt5/erp5_access_token_hal/bt/test_dependency_list
0 → 100644
View file @
41b29254
erp5_full_text_myisam_catalog
erp5_credential
\ No newline at end of file
bt5/erp5_access_token_hal/bt/title
0 → 100644
View file @
41b29254
erp5_access_token_hal
\ No newline at end of file
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