root/CPS3/products/CPSCore/trunk/AllowModules.py

Revision 54026, 3.4 kB (checked in by madarche, 4 months ago)

Adding
ModuleSecurityInfo?('Products.PythonScripts?.standard').declarePublic('newline_to_br')
made it needed to add also
ModuleSecurityInfo?('Products.PythonScripts?.standard').declarePublic('url_quote')
otherwise one would get something like
2009-11-15T21:16:29 BLATHER Zope Security Policy Unauthorized: The container has no security assertions. Access to 'url_quote' of (module 'Products.PythonScripts?.standard' from '/usr/local/zope/2.9.10/lib/python/Products/PythonScripts/standard.pyc') denied.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 # (C) Copyright 2003-2005 Nuxeo SARL <http://nuxeo.com>
2 # Author: Florent Guillaume <fg@nuxeo.com>
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 2 as published
6 # by the Free Software Foundation.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
16 # 02111-1307, USA.
17 #
18 # $Id$
19 """
20 Allow standard modules to be imported from restricted code.
21 """
22 # (see lib/python/Products/PythonScripts/module_access_example.py)
23
24 from AccessControl import allow_type, allow_class
25 from AccessControl import ModuleSecurityInfo
26
27 ModuleSecurityInfo('re').declarePublic('compile', 'findall',
28   'match', 'search', 'split', 'sub', 'subn', 'error',
29   'I', 'L', 'M', 'S', 'X')
30 import re
31 allow_type(type(re.compile('')))
32 allow_type(type(re.compile('x')))
33 allow_type(type(re.match('x', 'x')))
34 allow_type(type(re.sub('x', 'x', 'x')))
35
36 ModuleSecurityInfo('operator').declarePublic('attrgetter')
37 ModuleSecurityInfo('operator').declarePublic('itemgetter')
38 ModuleSecurityInfo('urllib').declarePublic('urlencode')
39 ModuleSecurityInfo('urllib').declarePublic('quote')
40 ModuleSecurityInfo('urllib').declarePublic('unquote')
41 ModuleSecurityInfo('cgi').declarePublic('escape')
42 ModuleSecurityInfo('Products.PythonScripts.standard').declarePublic('newline_to_br')
43 ModuleSecurityInfo('Products.PythonScripts.standard').declarePublic('url_quote')
44 ModuleSecurityInfo('zLOG').declarePublic('LOG', 'DEBUG', 'INFO')
45 ModuleSecurityInfo('zExceptions').declarePublic('Forbidden')
46 from logging import Logger
47 allow_class(Logger)
48 ModuleSecurityInfo('logging').declarePublic('getLogger')
49 ModuleSecurityInfo('logging').declarePublic('Logger')
50 ModuleSecurityInfo('AccessControl').declarePublic('Unauthorized')
51 ModuleSecurityInfo('types').declarePublic('IntType', 'StringType',
52                                           'ListType', 'DictType',
53                                           'TupleType')
54 ModuleSecurityInfo('DateTime.DateTime').declarePublic('DateTimeError')
55 ModuleSecurityInfo(
56     'Products.CMFCore.WorkflowCore').declarePublic('WorkflowException')
57 ModuleSecurityInfo('Products.CPSCore.utils').declarePublic(
58         'resetSessionLanguageSelection')
59
60 try:
61     ModuleSecurityInfo(
62         'Products.TextIndexNG2.BaseParser').declarePublic('QueryParserError')
63 except ImportError:
64     pass
65
66 try:
67     from mx import Tidy
68     allow_class(Tidy)
69     ModuleSecurityInfo('mx').declarePublic('Tidy')
70 except ImportError:
71     pass
72
73 ModuleSecurityInfo('Products.CPSCore.utils').declarePublic(
74     'KEYWORD_DOWNLOAD_FILE')
75 ModuleSecurityInfo('Products.CPSCore.utils').declarePublic(
76     'KEYWORD_ARCHIVED_REVISION')
77 ModuleSecurityInfo('Products.CPSCore.utils').declarePublic(
78     'KEYWORD_SWITCH_LANGUAGE')
79 ModuleSecurityInfo('Products.CPSCore.utils').declarePublic(
80     'KEYWORD_VIEW_LANGUAGE')
81 ModuleSecurityInfo('Products.CPSCore.utils').declarePublic(
82     'KEYWORD_VIEW_ZIP')
83 ModuleSecurityInfo('Products.CPSCore.utils').declarePublic(
84     'SESSION_LANGUAGE_KEY')
85 ModuleSecurityInfo('Products.CPSCore.utils').declarePublic(
86     'REQUEST_LANGUAGE_KEY')
Note: See TracBrowser for help on using the browser.