Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
1891b8ff
Commit
1891b8ff
authored
May 30, 2000
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed the fix to validating objects on import re: Shane's input on
protecting against Moniker abuse.
parent
dda0d6b3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
15 deletions
+25
-15
lib/python/OFS/CopySupport.py
lib/python/OFS/CopySupport.py
+22
-12
lib/python/OFS/ObjectManager.py
lib/python/OFS/ObjectManager.py
+3
-3
No files found.
lib/python/OFS/CopySupport.py
View file @
1891b8ff
...
...
@@ -83,7 +83,7 @@
#
##############################################################################
__doc__
=
"""Copy interface"""
__version__
=
'$Revision: 1.5
3
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.5
4
$'
[
11
:
-
2
]
import
sys
,
string
,
Globals
,
Moniker
,
tempfile
,
ExtensionClass
from
marshal
import
loads
,
dumps
...
...
@@ -339,16 +339,27 @@ class CopyContainer(ExtensionClass.Base):
validClipData
=
cb_dataValid
def
_verifyObjectPaste
(
self
,
ob
,
REQUEST
=
None
):
# Note that REQUEST is no longer needed - it is kept in the
# argument list for backward compatibility only.
if
not
hasattr
(
ob
,
'meta_type'
):
def
_verifyObjectPaste
(
self
,
object
,
validate_src
=
1
):
# Verify whether the current user is allowed to paste the
# passed object into self. This is determined by checking
# to see if the user could create a new object of the same
# meta_type of the object passed in and checking that the
# user actually is allowed to access the passed in object
# in its existing context.
#
# Passing a false value for the validate_src argument will skip
# checking the passed in object in its existing context. This is
# mainly useful for situations where the passed in object has no
# existing context, such as checking an object during an import
# (the object will not yet have been connected to the acquisition
# heirarchy).
if
not
hasattr
(
object
,
'meta_type'
):
raise
CopyError
,
MessageDialog
(
title
=
'Not Supported'
,
message
=
'The object <EM>%s</EM> does not support this '
\
'operation'
%
absattr
(
ob
.
id
),
'operation'
%
absattr
(
ob
ject
.
id
),
action
=
'manage_main'
)
mt
=
ob
.
meta_type
mt
=
ob
ject
.
meta_type
if
not
hasattr
(
self
,
'all_meta_types'
):
raise
CopyError
,
MessageDialog
(
title
=
'Not Supported'
,
...
...
@@ -362,21 +373,20 @@ class CopyContainer(ExtensionClass.Base):
method_name
=
d
[
'action'
]
break
# if REQUEST is None:
# REQUEST=getattr(self, 'REQUEST', None)
if
method_name
is
not
None
:
meth
=
self
.
unrestrictedTraverse
(
method_name
)
if
getSecurityManager
().
validateValue
(
meth
):
# Ensure the user is allowed to access the object on the
# clipboard.
if
getSecurityManager
().
validateValue
(
ob
):
if
not
validate_src
:
return
if
getSecurityManager
().
validateValue
(
object
):
return
raise
CopyError
,
MessageDialog
(
title
=
'Not Supported'
,
message
=
'The object <EM>%s</EM> does not support this '
\
'operation'
%
absattr
(
ob
.
id
),
'operation'
%
absattr
(
ob
ject
.
id
),
action
=
'manage_main'
)
Globals
.
default__class_init__
(
CopyContainer
)
...
...
lib/python/OFS/ObjectManager.py
View file @
1891b8ff
...
...
@@ -84,9 +84,9 @@
##############################################################################
__doc__
=
"""Object Manager
$Id: ObjectManager.py,v 1.9
6 2000/05/30 15:26:34
brian Exp $"""
$Id: ObjectManager.py,v 1.9
7 2000/05/30 20:27:17
brian Exp $"""
__version__
=
'$Revision: 1.9
6
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.9
7
$'
[
11
:
-
2
]
import
App.Management
,
Acquisition
,
Globals
,
CopySupport
,
Products
import
os
,
App
.
FactoryDispatcher
,
ts_regex
,
Products
...
...
@@ -506,7 +506,7 @@ class ObjectManager(
obj
=
obj
.
aq_parent
connection
=
obj
.
_p_jar
ob
=
connection
.
importFile
(
file
)
if
REQUEST
:
self
.
_verifyObjectPaste
(
ob
)
if
REQUEST
:
self
.
_verifyObjectPaste
(
ob
,
validate_src
=
0
)
id
=
ob
.
id
if
hasattr
(
id
,
'im_func'
):
id
=
id
()
self
.
_setObject
(
id
,
ob
)
...
...
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