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
140
Merge Requests
140
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
09293477
Commit
09293477
authored
Apr 25, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to edit plugin.
parent
cdbbb49b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
2 deletions
+74
-2
product/ERP5Security/ERP5BearerExtractionPlugin.py
product/ERP5Security/ERP5BearerExtractionPlugin.py
+45
-2
product/ERP5Security/www/ERP5Security_editERP5BearerExtractionPlugin.zpt
...urity/www/ERP5Security_editERP5BearerExtractionPlugin.zpt
+29
-0
No files found.
product/ERP5Security/ERP5BearerExtractionPlugin.py
View file @
09293477
...
...
@@ -35,7 +35,7 @@ from Products.PluggableAuthService.utils import classImplements
from
Products.PluggableAuthService.plugins.BasePlugin
import
BasePlugin
from
Products.ERP5Security.ERP5UserManager
import
SUPER_USER
from
Products.PluggableAuthService.PluggableAuthService
import
DumbHTTPExtractor
from
Products.PluggableAuthService.permissions
import
ManageUsers
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
setSecurityManager
,
newSecurityManager
from
DateTime
import
DateTime
...
...
@@ -67,6 +67,22 @@ class ERP5BearerExtractionPlugin(BasePlugin):
meta_type
=
"ERP5 Bearer Extraction Plugin"
security
=
ClassSecurityInfo
()
token_portal_type
=
''
manage_options
=
(({
'label'
:
'Edit'
,
'action'
:
'manage_editERP5BearerExtractionPluginForm'
,},
)
+
BasePlugin
.
manage_options
[:]
)
_properties
=
(({
'id'
:
'token_portal_type'
,
'type'
:
'string'
,
'mode'
:
'w'
,
'label'
:
'Portal Type with tokens'
},
)
+
BasePlugin
.
_properties
[:]
)
def
__init__
(
self
,
id
,
token_portal_type
,
title
=
None
):
#Register value
...
...
@@ -85,7 +101,7 @@ class ERP5BearerExtractionPlugin(BasePlugin):
if
request
.
_auth
is
not
None
:
# 1st - try to fetch from Authorization header
if
'Bearer'
in
request
.
_auth
:
l
=
authorisation
.
split
()
l
=
request
.
_auth
.
split
()
if
len
(
l
)
==
2
:
token
=
l
[
1
]
...
...
@@ -132,6 +148,33 @@ class ERP5BearerExtractionPlugin(BasePlugin):
# fallback to default way
return
DumbHTTPExtractor
().
extractCredentials
(
request
)
manage_editERP5BearerExtractionPluginForm
=
PageTemplateFile
(
'www/ERP5Security_editERP5BearerExtractionPlugin'
,
globals
(),
__name__
=
'manage_editERP5BearerExtractionPluginForm'
)
security
.
declareProtected
(
ManageUsers
,
'manage_editERP5BearerExtractionPlugin'
)
def
manage_editERP5BearerExtractionPlugin
(
self
,
token_portal_type
,
RESPONSE
=
None
):
"""Edit the object"""
error_message
=
''
if
token_portal_type
==
''
or
token_portal_type
is
None
:
error_message
+=
'Token Portal Type is missing '
else
:
self
.
token_portal_type
=
token_portal_type
#Redirect
if
RESPONSE
is
not
None
:
if
error_message
!=
''
:
self
.
REQUEST
.
form
[
'manage_tabs_message'
]
=
error_message
return
self
.
manage_editERP5BearerExtractionPluginForm
(
RESPONSE
)
else
:
message
=
"Updated"
RESPONSE
.
redirect
(
'%s/manage_editERP5BearerExtractionPluginForm'
'?manage_tabs_message=%s'
%
(
self
.
absolute_url
(),
message
)
)
#List implementation of class
classImplements
(
ERP5BearerExtractionPlugin
,
plugins
.
ILoginPasswordHostExtractionPlugin
...
...
product/ERP5Security/www/ERP5Security_editERP5BearerExtractionPlugin.zpt
0 → 100644
View file @
09293477
<h1 tal:replace="structure context/manage_page_header">PAGE HEADER</h1>
<h2 tal:replace="structure here/manage_tabs"> TABS </h2>
<h2 tal:define="form_title string:Edit ERP5 Bearer Extraction Plugin"
tal:replace="structure context/manage_form_title">FORM TITLE</h2>
<p class="form-help">Please configure portal type containing tokens</p>
<form action="manage_editERP5BearerExtractionPlugin" method="POST">
<table tal:define="token_portal_type request/token_portal_type|context/token_portal_type|string:;">
<tr>
<td>Portal Type with tokens</td>
<td>
<input type="text" name="token_portal_type" value=""
tal:attributes="value token_portal_type;" />
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="save"/>
</td>
</tr>
</table>
</form>
<h1 tal:replace="structure context/manage_page_footer">PAGE FOOTER</h1>
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