[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security - ZopeSecurityPolicy.py:1.1.2.19
Steve Alexander
steve@cat-box.net
Fri, 1 Mar 2002 06:02:06 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Security
In directory cvs.zope.org:/tmp/cvs-serv1526
Modified Files:
Tag: Zope-3x-branch
ZopeSecurityPolicy.py
Log Message:
changed validate to allow ints and objects with an
__allow_access_to_unprotected_subobjects__ attribute as Zope.Public
this is needed to get TALES iterators working, using repeat/name/index
notation, which is required for the ZMI.
=== Zope3/lib/python/Zope/App/Security/ZopeSecurityPolicy.py 1.1.2.18 => 1.1.2.19 ===
from Zope.App.Security.Settings import Allow, Deny, Assign, Remove, Unset
-from types import StringTypes, ListType
+from types import StringTypes, ListType, IntType
getPermissionsForPrincipal = \
principalPermissionManager.getPermissionsForPrincipal
@@ -85,7 +85,11 @@
except AttributeError:
# XXX: allow some simple types to get ZMI working
# is this the right thing to do?
- if isinstance(value, (ListType, StringTypes)):
+ # Also, respect the attribute
+ # __allow_access_to_unprotected_subobjects__
+ # as used in TALES iterators and other places
+ if (isinstance(value, (ListType, StringTypes, IntType)) or
+ getattr(value,'__allow_access_to_unprotected_subobjects__',0)):
permission = 'Zope.Public'
else:
raise Forbidden(name, value, 'No permission set')