Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_workflow
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenjie.zheng
erp5_workflow
Commits
935a2cfc
Commit
935a2cfc
authored
Apr 02, 2015
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename unrestricted_contextmanager to super_user and use it directly in UnrestrictedMethod
parent
15f7d8f1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
product/ERP5Type/UnrestrictedMethod.py
product/ERP5Type/UnrestrictedMethod.py
+8
-5
No files found.
product/ERP5Type/UnrestrictedMethod.py
View file @
935a2cfc
...
@@ -65,7 +65,10 @@ def UnrestrictedMethod(function):
...
@@ -65,7 +65,10 @@ def UnrestrictedMethod(function):
This method is dangerous. Enough said. Be careful.
This method is dangerous. Enough said. Be careful.
"""
"""
return
lambda
*
args
,
**
kw
:
unrestricted_apply
(
function
,
args
,
kw
)
def
unrestricted_apply
(
*
args
,
**
kw
):
with
super_user
():
return
function
(
*
args
,
**
kw
)
return
unrestricted_apply
def
unrestricted_apply
(
function
,
args
=
(),
kw
=
{}):
# XXX-JPS: naming
def
unrestricted_apply
(
function
,
args
=
(),
kw
=
{}):
# XXX-JPS: naming
"""Function to bypass all security checks
"""Function to bypass all security checks
...
@@ -74,12 +77,12 @@ def unrestricted_apply(function, args=(), kw={}): # XXX-JPS: naming
...
@@ -74,12 +77,12 @@ def unrestricted_apply(function, args=(), kw={}): # XXX-JPS: naming
docstring for more information. Never use this, until you are 100% certain
docstring for more information. Never use this, until you are 100% certain
that you have no other way.
that you have no other way.
"""
"""
with
unrestricted_contextmanag
er
():
with
super_us
er
():
return
apply
(
function
,
args
,
kw
)
return
function
(
*
args
,
**
kw
)
@
contextmanager
@
contextmanager
def
unrestricted_contextmanag
er
():
def
super_us
er
():
"""
Function
to bypass all security checks
"""
Context manager
to bypass all security checks
This function is as dangerous as 'UnrestrictedMethod' decorator. Read its
This function is as dangerous as 'UnrestrictedMethod' decorator. Read its
docstring for more information. Never use this, until you are 100% certain
docstring for more information. Never use this, until you are 100% certain
...
...
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