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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Georgios Dagkakis
erp5
Commits
472f5d8b
Commit
472f5d8b
authored
Mar 23, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PreferenceTool: fix missing security on getPreference
parent
b2a2c97c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testPreferences.py
...mplateItem/portal_components/test.erp5.testPreferences.py
+1
-0
product/ERP5Form/PreferenceTool.py
product/ERP5Form/PreferenceTool.py
+3
-2
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testPreferences.py
View file @
472f5d8b
...
...
@@ -651,6 +651,7 @@ class TestPreferences(PropertySheetTestCase):
preference_tool
.
manage_permission
(
read_permission
,
[],
0
)
obj
.
manage_permission
(
read_permission
,
[],
0
)
self
.
assertFalse
(
guarded_hasattr
(
preference_tool
,
'getPreferredToto'
))
self
.
assertEqual
(
preference_tool
.
getPreference
(
'toto'
),
None
)
preference_tool
.
manage_permission
(
read_permission
,
[
'Manager'
],
1
)
...
...
product/ERP5Form/PreferenceTool.py
View file @
472f5d8b
...
...
@@ -30,6 +30,7 @@
from
AccessControl
import
ClassSecurityInfo
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
setSecurityManager
,
newSecurityManager
from
AccessControl.ZopeGuards
import
guarded_getattr
from
MethodObject
import
Method
from
Products.ERP5Type.Globals
import
InitializeClass
,
DTMLFile
from
zLOG
import
LOG
,
PROBLEM
...
...
@@ -128,8 +129,8 @@ class PreferenceTool(BaseTool):
security
.
declarePublic
(
'getPreference'
)
def
getPreference
(
self
,
pref_name
,
default
=
_marker
)
:
""" get the preference on the most appopriate Preference object. """
method
=
getattr
(
self
,
'get%s'
%
convertToUpperCase
(
pref_name
),
None
)
""" get the preference on the most app
r
opriate Preference object. """
method
=
g
uarded_g
etattr
(
self
,
'get%s'
%
convertToUpperCase
(
pref_name
),
None
)
if
method
is
not
None
:
return
method
(
default
)
if
default
is
_marker
:
...
...
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