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
amrani
erp5
Commits
d8af8315
Commit
d8af8315
authored
Apr 25, 2012
by
Łukasz Nowak
Committed by
Rafael Monnerat
Sep 17, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to edit plugin.
parent
d5008fbe
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 @
d8af8315
...
@@ -35,7 +35,7 @@ from Products.PluggableAuthService.utils import classImplements
...
@@ -35,7 +35,7 @@ from Products.PluggableAuthService.utils import classImplements
from
Products.PluggableAuthService.plugins.BasePlugin
import
BasePlugin
from
Products.PluggableAuthService.plugins.BasePlugin
import
BasePlugin
from
Products.ERP5Security.ERP5UserManager
import
SUPER_USER
from
Products.ERP5Security.ERP5UserManager
import
SUPER_USER
from
Products.PluggableAuthService.PluggableAuthService
import
DumbHTTPExtractor
from
Products.PluggableAuthService.PluggableAuthService
import
DumbHTTPExtractor
from
Products.PluggableAuthService.permissions
import
ManageUsers
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
setSecurityManager
,
newSecurityManager
setSecurityManager
,
newSecurityManager
from
DateTime
import
DateTime
from
DateTime
import
DateTime
...
@@ -67,6 +67,22 @@ class ERP5BearerExtractionPlugin(BasePlugin):
...
@@ -67,6 +67,22 @@ class ERP5BearerExtractionPlugin(BasePlugin):
meta_type
=
"ERP5 Bearer Extraction Plugin"
meta_type
=
"ERP5 Bearer Extraction Plugin"
security
=
ClassSecurityInfo
()
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
):
def
__init__
(
self
,
id
,
token_portal_type
,
title
=
None
):
#Register value
#Register value
...
@@ -85,7 +101,7 @@ class ERP5BearerExtractionPlugin(BasePlugin):
...
@@ -85,7 +101,7 @@ class ERP5BearerExtractionPlugin(BasePlugin):
if
request
.
_auth
is
not
None
:
if
request
.
_auth
is
not
None
:
# 1st - try to fetch from Authorization header
# 1st - try to fetch from Authorization header
if
'Bearer'
in
request
.
_auth
:
if
'Bearer'
in
request
.
_auth
:
l
=
authorisation
.
split
()
l
=
request
.
_auth
.
split
()
if
len
(
l
)
==
2
:
if
len
(
l
)
==
2
:
token
=
l
[
1
]
token
=
l
[
1
]
...
@@ -132,6 +148,33 @@ class ERP5BearerExtractionPlugin(BasePlugin):
...
@@ -132,6 +148,33 @@ class ERP5BearerExtractionPlugin(BasePlugin):
# fallback to default way
# fallback to default way
return
DumbHTTPExtractor
().
extractCredentials
(
request
)
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
#List implementation of class
classImplements
(
ERP5BearerExtractionPlugin
,
classImplements
(
ERP5BearerExtractionPlugin
,
plugins
.
ILoginPasswordHostExtractionPlugin
plugins
.
ILoginPasswordHostExtractionPlugin
...
...
product/ERP5Security/www/ERP5Security_editERP5BearerExtractionPlugin.zpt
0 → 100644
View file @
d8af8315
<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