[Zope3-checkins] CVS: Zope3/src/zope/app/security - _protections.zcml:1.1 _protections.py:1.10 configure.zcml:1.12

Jim Fulton jim at zope.com
Sat Feb 21 07:28:56 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/security
In directory cvs.zope.org:/tmp/cvs-serv1370/src/zope/app/security

Modified Files:
	_protections.py configure.zcml 
Added Files:
	_protections.zcml 
Log Message:
Moved permission declarations for persistent objects from Python to
ZCML to prevent declarations, and thus, import of persistent types
as a side effect of importing zope.app.  This is to avoid weird
conflicts in FrankenZope installations, which currently run ZODB 3.2.


=== Added File Zope3/src/zope/app/security/_protections.zcml ===
<configure
    xmlns="http://namespaces.zope.org/zope"
    i18n_domain="zope"
    >

<!-- ===================================================================== -->

<content class="BTrees.IIBTree.IIBTree">
   <allow attributes="__str__ __contains__ __getitem__ __iter__ __len__
                      byValue get has_key items iteritems iterkeys
                      itervalues keys maxKey minKey values" /> 
</content>
<content class="BTrees.IIBTree.IIBucket">
   <allow attributes="__contains__ __getitem__ __iter__ __len__ __str__
                      byValue get has_key items iteritems iterkeys
                      itervalues keys maxKeyminKey values" /> 
</content>
<content class="BTrees.IIBTree.IISet">
   <allow attributes="__contains__ __iter__ __len__ __str__ has_key insert
                      keys maxKey minKey" /> 
</content>
<content class="BTrees.IIBTree.IITreeIterator">
   <allow attributes="__iter__ __str__ __getitem__ __len__ __contains__" /> 
</content>

<!-- ===================================================================== -->

<content class="BTrees.IOBTree.IOBTree">
   <allow attributes="__str__ __contains__ __getitem__ __iter__ __len__
                      byValue get has_key items iteritems iterkeys
                      itervalues keys maxKey minKey values" /> 
</content>
<content class="BTrees.IOBTree.IOBucket">
   <allow attributes="__contains__ __getitem__ __iter__ __len__ __str__
                      byValue get has_key items iteritems iterkeys
                      itervalues keys maxKeyminKey values" /> 
</content>
<content class="BTrees.IOBTree.IOSet">
   <allow attributes="__contains__ __iter__ __len__ __str__ has_key insert
                      keys maxKey minKey" /> 
</content>
<content class="BTrees.IOBTree.IOTreeIterator">
   <allow attributes="__iter__ __str__ __getitem__ __len__ __contains__" /> 
</content>

<!-- ===================================================================== -->

<content class="BTrees.OIBTree.OIBTree">
   <allow attributes="__str__ __contains__ __getitem__ __iter__ __len__
                      byValue get has_key items iteritems iterkeys
                      itervalues keys maxKey minKey values" /> 
</content>
<content class="BTrees.OIBTree.OIBucket">
   <allow attributes="__contains__ __getitem__ __iter__ __len__ __str__
                      byValue get has_key items iteritems iterkeys
                      itervalues keys maxKeyminKey values" /> 
</content>
<content class="BTrees.OIBTree.OISet">
   <allow attributes="__contains__ __iter__ __len__ __str__ has_key insert
                      keys maxKey minKey" /> 
</content>
<content class="BTrees.OIBTree.OITreeIterator">
   <allow attributes="__iter__ __str__ __getitem__ __len__ __contains__" /> 
</content>

<!-- ===================================================================== -->

<content class="BTrees.OOBTree.OOBTree">
   <allow attributes="__str__ __contains__ __getitem__ __iter__ __len__
                      byValue get has_key items iteritems iterkeys
                      itervalues keys maxKey minKey values" /> 
</content>
<content class="BTrees.OOBTree.OOBucket">
   <allow attributes="__contains__ __getitem__ __iter__ __len__ __str__
                      byValue get has_key items iteritems iterkeys
                      itervalues keys maxKeyminKey values" /> 
</content>
<content class="BTrees.OOBTree.OOSet">
   <allow attributes="__contains__ __iter__ __len__ __str__ has_key insert
                      keys maxKey minKey" /> 
</content>
<content class="BTrees.OOBTree.OOTreeIterator">
   <allow attributes="__iter__ __str__ __getitem__ __len__ __contains__" /> 
</content>

<!-- ===================================================================== -->

<content class="persistent.list.PersistentList">
   <allow attributes="__getitem__ __getslice__ __len__ __iter__
                      __contains__ index count" /> 
</content>
<content class="persistent.dict.PersistentDict">
   <allow attributes="__getitem__ __len__ __iter__ get has_key
                      __copy__ keys values items iterkeys iteritems
                      itervalues __contains__" /> 
</content>

<!-- ===================================================================== -->

</configure>



=== Zope3/src/zope/app/security/_protections.py 1.9 => 1.10 ===
--- Zope3/src/zope/app/security/_protections.py:1.9	Fri Feb 20 17:02:31 2004
+++ Zope3/src/zope/app/security/_protections.py	Sat Feb 21 07:28:55 2004
@@ -19,87 +19,6 @@
 def protect():
     from zope.security.checker import defineChecker, NamesChecker, NoProxy
 
-
-    # excluding _check, _bucket_type, _firstbucket, and write operations
-    _btreeChecker = NamesChecker(['__str__', '__contains__',
-                                  '__getitem__', '__iter__', '__len__',
-                                  'byValue', 'get', 'has_key', 'items',
-                                  'iteritems', 'iterkeys', 'itervalues',
-                                  'keys', 'maxKey', 'minKey', 'values'])
-
-    # excluding _next
-    _btreeBucketChecker = NamesChecker([
-            '__contains__', '__getitem__', '__iter__', '__len__',
-            '__str__', 'byValue', 'get', 'has_key', 'items', 'iteritems',
-            'iterkeys', 'itervalues', 'keys', 'maxKey','minKey', 'values'])
-
-    _btreeSetChecker = NamesChecker([
-            '__contains__', '__getitem__', '__iter__', '__len__',
-            '__str__', 'has_key', 'insert', 'keys', 'maxKey', 'minKey'])
-
-    # excluding _bucket_type, _check
-    _btreeTreeSetChecker = NamesChecker([
-            '__contains__', '__iter__', '__len__',
-            '__str__', 'has_key', 'insert', 'keys', 'maxKey', 'minKey'])
-
-    _btreeItemsChecker = NamesChecker([
-            '__iter__', '__str__', '__getitem__', '__len__', '__contains__'])
-
-    _iteratorChecker = NamesChecker(['next'])
-
-    from BTrees.IIBTree import IIBTree, IIBucket, IISet, IITreeSet
-    from BTrees.IOBTree import IOBTree, IOBucket, IOSet, IOTreeSet
-    from BTrees.OIBTree import OIBTree, OIBucket, OISet, OITreeSet
-    from BTrees.OOBTree import OOBTree, OOBucket, OOSet, OOTreeSet
-
-    _btree_checkers = {
-        IIBTree: _btreeChecker,
-        IOBTree: _btreeChecker,
-        OIBTree: _btreeChecker,
-        OOBTree: _btreeChecker,
-        IIBucket: _btreeBucketChecker,
-        IOBucket: _btreeBucketChecker,
-        OIBucket: _btreeBucketChecker,
-        OOBucket: _btreeBucketChecker,
-        IISet: _btreeSetChecker,
-        IOSet: _btreeSetChecker,
-        OISet: _btreeSetChecker,
-        OOSet: _btreeSetChecker,
-        IITreeSet: _btreeTreeSetChecker,
-        IOTreeSet: _btreeTreeSetChecker,
-        OITreeSet: _btreeTreeSetChecker,
-        OOTreeSet: _btreeTreeSetChecker,
-        type(iter(IIBTree())): NoProxy, # II-iterator is a rock
-        type(iter(IOBTree())): _iteratorChecker, # IO-iterator
-        type(iter(OIBTree())): _iteratorChecker, # OI-iterator
-        type(iter(OOBTree())): _iteratorChecker, # OO-iterator
-        type(IIBTree().keys()): NoProxy, # IIBTreeItems is a rock
-        type(IOBTree().keys()): _btreeItemsChecker, # IOBTreeItems
-        type(OIBTree().keys()): _btreeItemsChecker, # OIBTreeItems
-        type(OOBTree().keys()): _btreeItemsChecker, # OOBTreeItems
-    }
-    for which_type, checker in _btree_checkers.iteritems():
-        defineChecker(which_type, checker)
-
-    from persistent.list import PersistentList
-
-    defineChecker(PersistentList,
-                  NamesChecker(
-                     ['__getitem__', '__getslice__', '__len__', '__iter__',
-                      '__contains__', 'index', 'count'])
-                  )
-
-    from persistent.dict import PersistentDict
-
-    defineChecker(PersistentDict,
-                  NamesChecker(['__getitem__', '__len__', '__iter__',
-                        'get', 'has_key', '__copy__',
-                        'keys', 'values', 'items',
-                        'iterkeys', 'iteritems', 'itervalues', '__contains__',
-                        ]
-                     )
-                  )
-
     # Make sure the message id gets never proxied
     from zope.i18n.messageid import MessageID
     defineChecker(MessageID, NoProxy)


=== Zope3/src/zope/app/security/configure.zcml 1.11 => 1.12 ===
--- Zope3/src/zope/app/security/configure.zcml:1.11	Thu Jan 29 19:25:40 2004
+++ Zope3/src/zope/app/security/configure.zcml	Sat Feb 21 07:28:55 2004
@@ -5,6 +5,7 @@
 
   <include package=".registries" />
   <include file="globalmodules.zcml" />
+  <include file="_protections.zcml" />
 
   <!-- Standard Permissions -->
 




More information about the Zope3-Checkins mailing list