Commit 2aa227f6 authored by 's avatar

Added support for pasting of "Product" based objects

parent fbf3b1b7
__doc__="""Copy interface""" __doc__="""Copy interface"""
__version__='$Revision: 1.20 $'[11:-2] __version__='$Revision: 1.21 $'[11:-2]
import sys, Globals, Moniker, tempfile import sys, string, Globals, Moniker, tempfile
from marshal import loads, dumps from marshal import loads, dumps
from urllib import quote, unquote from urllib import quote, unquote
from zlib import compress, decompress from zlib import compress, decompress
...@@ -215,19 +215,32 @@ class CopyContainer: ...@@ -215,19 +215,32 @@ class CopyContainer:
method_name=d['action'] method_name=d['action']
break break
if method_name is not None: if method_name is not None:
if hasattr(self, method_name): if hasattr(self, method_name):
meth=getattr(self, method_name) meth=getattr(self, method_name)
if hasattr(meth, '__roles__'): else:
roles=meth.__roles__ # Handle strange names that come from the Product
user=REQUEST.get('AUTHENTICATED_USER', None) # machinery ;(
__traceback_info__=method_name, user mn=string.split(method_name, '/')
if (not hasattr(user, 'hasRole') or if len(mn) > 1:
not user.hasRole(None, roles)): pname= mn[1]
raise 'Unauthorized', ( product=self.aq_acquire('_getProducts')()._product(pname)
"""You are not authorized to perform this fname=mn[2]
operation.""" factory=getattr(product, fname)
) meth=getattr(factory, factory.initial)
return
if hasattr(meth, '__roles__'):
roles=meth.__roles__
user=REQUEST.get('AUTHENTICATED_USER', None)
__traceback_info__=method_name, user
if (not hasattr(user, 'hasRole') or
not user.hasRole(None, roles)):
raise 'Unauthorized', (
"""You are not authorized to perform this
operation."""
)
return
raise CopyError, MessageDialog( raise CopyError, MessageDialog(
title='Not Supported', title='Not Supported',
message='The object <EM>%s</EM> does not support this ' \ message='The object <EM>%s</EM> does not support this ' \
...@@ -382,6 +395,9 @@ eNotSupported=fMessageDialog( ...@@ -382,6 +395,9 @@ eNotSupported=fMessageDialog(
############################################################################## ##############################################################################
# #
# $Log: CopySupport.py,v $ # $Log: CopySupport.py,v $
# Revision 1.21 1998/09/21 20:01:50 brian
# Added support for pasting of "Product" based objects
#
# Revision 1.20 1998/08/26 18:33:44 brian # Revision 1.20 1998/08/26 18:33:44 brian
# Updated permissions in Folder folder for the copy/paste methods and added # Updated permissions in Folder folder for the copy/paste methods and added
# cvs log to Folder.py # cvs log to Folder.py
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment