[Zope-Checkins] CVS: Zope3/lib/python/Zope/Security - Proxy.py:1.1.4.1.8.2

Jim Fulton jim@zope.com
Thu, 6 Jun 2002 17:48:53 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/Security
In directory cvs.zope.org:/tmp/cvs-serv19481/lib/python/Zope/Security

Modified Files:
      Tag: Zope3InWonderland-branch
	Proxy.py 
Log Message:
Added a new method, trustedRemoveSecurityProxy that removes 
security proxies from "trusted" objects. 

The code for getting service managers calls this when a service
manager found is trusted.  The placeful service manager will need to
call this for trusted services and placeful component managers will
need to do so for trusted components.



=== Zope3/lib/python/Zope/Security/Proxy.py 1.1.4.1.8.1 => 1.1.4.1.8.2 ===
 from _Proxy import getObject, getChecker
 from _Proxy import _Proxy as Proxy
-from Checker import ProxyFactory
+from Checker import ProxyFactory, Checker as _trustedChecker
 
+def trustedRemoveSecurityProxy(object):
+    if ((type(object) is Proxy) and
+        isinstance(getChecker(object), _trustedChecker)
+        ):
+        return getObject(object)
+
+    return object
 
 
 def getTestProxyItems(proxy):