[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security - PrincipalRegistry.py:

Guido van Rossum guido@python.org
Thu, 13 Dec 2001 15:47:09 -0500

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

Modified Files:
      Tag: Zope-3x-branch
Log Message:
Added implementation to unauthorized() method:
if no authenticated user, send login challenge.

=== Zope3/lib/python/Zope/App/Security/PrincipalRegistry.py => ===
     def unauthorized(self, id, request):
-        pass
+        if id is None or id is self.__defaultid:
+            a = getAdapter(request, ILoginPassword, None)
+            a.needLogin(realm="zope")
     def getPrincipal(self, id):
         r = self.__principalsById.get(id)