[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Security - ZopeSecurityPolicy.py:1.6

Jim Fulton jim@zope.com
Tue, 13 Aug 2002 13:46:13 -0400


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

Modified Files:
	ZopeSecurityPolicy.py 
Log Message:
Introduced a system user
(Zope.Security.SecurityManagement.system_user)
that has all permissions.  This was necessary so startup code and
testing code can avoid authorization failures.



=== Zope3/lib/python/Zope/App/Security/ZopeSecurityPolicy.py 1.5 => 1.6 ===
--- Zope3/lib/python/Zope/App/Security/ZopeSecurityPolicy.py:1.5	Tue Jul 16 19:41:17 2002
+++ Zope3/lib/python/Zope/App/Security/ZopeSecurityPolicy.py	Tue Aug 13 13:46:12 2002
@@ -18,9 +18,14 @@
 __version__='$Revision$'[11:-2]
 
 from Zope.ComponentArchitecture import queryAdapter
+
 from Zope.Proxy.ContextWrapper import ContainmentIterator
+
 from Zope.Exceptions import Unauthorized, Forbidden
+
 from Zope.Security.ISecurityPolicy import ISecurityPolicy
+from Zope.Security.SecurityManagement import system_user
+
 from Zope.App.Security.IRolePermissionManager \
      import IRolePermissionManager, IRolePermissionMap
 from Zope.App.Security.IPrincipalPermissionManager \
@@ -80,7 +85,11 @@
         # XXX We aren't really handling multiple principals yet
 
         # mapping from principal to set of roles
-        principals = { context.user : {'Anonymous': Allow} }
+        user = context.user
+        if user is system_user:
+            return 1
+        
+        principals = {user : {'Anonymous': Allow}}
         
         role_permissions = {}
         remove = {}