[Zope-CVS] CVS: Products/PluggableAuthService - PluggableAuthService.py:1.27 __init__.py:1.6 version.txt:1.4

Tres Seaver tseaver at zope.com
Thu Jan 27 14:00:53 EST 2005


Update of /cvs-repository/Products/PluggableAuthService
In directory cvs.zope.org:/tmp/cvs-serv8352

Modified Files:
	PluggableAuthService.py __init__.py version.txt 
Log Message:
 - Merge 'zc-pas_fix_logout-branch', and release version 1.0.4.


=== Products/PluggableAuthService/PluggableAuthService.py 1.26 => 1.27 ===
--- Products/PluggableAuthService/PluggableAuthService.py:1.26	Sat Nov 20 15:02:20 2004
+++ Products/PluggableAuthService/PluggableAuthService.py	Thu Jan 27 14:00:22 2005
@@ -45,7 +45,7 @@
 from Products.PluginRegistry.PluginRegistry import PluginRegistry
 import Products
 
-from interfaces.authservice import IUserFolder
+from interfaces.authservice import IPluggableAuthService
 from interfaces.authservice import _noroles
 from interfaces.plugins import IExtractionPlugin
 from interfaces.plugins import ILoginPasswordHostExtractionPlugin
@@ -159,7 +159,7 @@
 
     """ All-singing, all-dancing user folder.
     """
-    __implements__ = ( IUserFolder, )
+    __implements__ = ( IPluggableAuthService, )
 
     security = ClassSecurityInfo()
 
@@ -1192,7 +1192,7 @@
         """
         return True
 
-    security.declarePrivate('updateCredentials')
+    security.declarePublic('updateCredentials')
     def updateCredentials(self, request, response, login, new_password):
         """Central updateCredentials method
 
@@ -1218,9 +1218,11 @@
         # Little bit of a hack: Issuing a redirect to the same place
         # where the user was so that in the second request the now-destroyed
         # credentials can be acted upon to e.g. go back to the login page
-        REQUEST['RESPONSE'].redirect(REQUEST['HTTP_REFERER'])
+        referrer = REQUEST.get('HTTP_REFERER') # HTTP_REFERER is optional header
+        if referrer:
+            REQUEST['RESPONSE'].redirect(referrer)
 
-    security.declarePrivate('_resetCredentials')
+    security.declarePublic('resetCredentials')
     def resetCredentials(self, request, response):
         """Reset credentials by informing all active resetCredentials plugins
         """


=== Products/PluggableAuthService/__init__.py 1.5 => 1.6 ===
--- Products/PluggableAuthService/__init__.py:1.5	Mon Nov  8 17:35:44 2004
+++ Products/PluggableAuthService/__init__.py	Thu Jan 27 14:00:22 2005
@@ -59,6 +59,38 @@
 registerMultiPlugin(RGP.RecursiveGroupsPlugin.meta_type)
 registerMultiPlugin(DGP.DynamicGroupsPlugin.meta_type)
 
+# monkey patch Zope to cause zmi logout to be PAS-aware
+from App.Management import Navigation
+from interfaces.authservice import IPluggableAuthService
+
+def manage_zmi_logout(self, REQUEST, RESPONSE):
+    """Logout current user"""
+    p = getattr(REQUEST, '_logout_path', None)
+    if p is not None:
+        return apply(self.restrictedTraverse(p))
+    acl_users = self.acl_users
+    if IPluggableAuthService.isImplementedBy(acl_users):
+        acl_users.resetCredentials(REQUEST, RESPONSE)
+    else:
+        realm=RESPONSE.realm
+        RESPONSE.setStatus(401)
+        RESPONSE.setHeader('WWW-Authenticate', 'basic realm="%s"' % realm, 1)    
+    referrer = REQUEST.get('HTTP_REFERER') # HTTP_REFERER is optional header
+    if referrer:
+        REQUEST['RESPONSE'].redirect(referrer)
+    else:
+        RESPONSE.setBody("""<html>
+<head><title>Logout</title></head>
+<body>
+<p>
+You have been logged out.
+</p>
+</body>
+</html>""")
+
+Navigation.manage_zmi_logout = manage_zmi_logout
+del manage_zmi_logout
+
 def initialize(context):
 
     context.registerClass( PluggableAuthService.PluggableAuthService


=== Products/PluggableAuthService/version.txt 1.3 => 1.4 ===
--- Products/PluggableAuthService/version.txt:1.3	Sat Nov  6 07:10:56 2004
+++ Products/PluggableAuthService/version.txt	Thu Jan 27 14:00:22 2005
@@ -1 +1 @@
-1.0.3
+PluggableAuthService-1.0.4



More information about the Zope-CVS mailing list