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
Xiaowu Zhang
erp5
Commits
ab4649fb
Commit
ab4649fb
authored
Aug 29, 2011
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
contribution by Boris Kocherov : initialize FolderMixIn for methods protection.
parent
3ac8a940
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
product/ERP5Type/Core/Folder.py
product/ERP5Type/Core/Folder.py
+2
-0
product/ERP5Type/tests/testFolder.py
product/ERP5Type/tests/testFolder.py
+11
-0
No files found.
product/ERP5Type/Core/Folder.py
View file @
ab4649fb
...
...
@@ -45,6 +45,7 @@ from Products.ERP5Type import PropertySheet
from
Products.ERP5Type.XMLExportImport
import
Folder_asXML
from
Products.ERP5Type.Utils
import
sortValueList
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type.Globals
import
InitializeClass
try
:
from
Products.CMFCore.CMFBTreeFolder
import
CMFBTreeFolder
...
...
@@ -452,6 +453,7 @@ OFS_HANDLER = 0
BTREE_HANDLER
=
1
HBTREE_HANDLER
=
2
InitializeClass
(
FolderMixIn
)
class
Folder
(
CopyContainer
,
CMFBTreeFolder
,
CMFHBTreeFolder
,
Base
,
FolderMixIn
):
"""
...
...
product/ERP5Type/tests/testFolder.py
View file @
ab4649fb
...
...
@@ -252,6 +252,17 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor):
self
.
assertNotEquals
(
self
.
folder
[
obj
.
getId
()].
__class__
,
from_class
)
self
.
assertEquals
([
1
],
result
)
def
test_FolderMixinSecurity
(
self
):
""" Test if FolderMix methods cannot be called by URL """
type_list
=
[
'Folder'
]
self
.
_setAllowedContentTypesForFolderType
(
type_list
)
obj
=
self
.
folder
.
newContent
(
portal_type
=
'Folder'
)
transaction
.
commit
()
response
=
self
.
publish
(
'%s/deleteContent?id=%s'
%
(
self
.
folder
.
absolute_url
(
relative
=
True
),
obj
.
getId
()))
self
.
assertTrue
(
obj
.
getId
()
in
self
.
folder
.
objectIds
())
self
.
assertEquals
(
302
,
response
.
getStatus
())
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestFolder
))
...
...
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