[Zope-CVS] CVS: Products/PluggableAuthService - PluggableAuthService.py:1.6.2.1

Lennart Regebro regebro at nuxeo.com
Mon Aug 30 10:43:30 EDT 2004


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

Modified Files:
      Tag: regebro-implement_challenge-branch
	PluggableAuthService.py 
Log Message:



=== Products/PluggableAuthService/PluggableAuthService.py 1.6 => 1.6.2.1 ===
--- Products/PluggableAuthService/PluggableAuthService.py:1.6	Mon Aug 30 09:22:41 2004
+++ Products/PluggableAuthService/PluggableAuthService.py	Mon Aug 30 10:43:00 2004
@@ -264,6 +264,36 @@
                 return user
 
         if not is_top:
+            # Try to validate with user folders higher up.
+            innerob=self.aq_parent
+            while hasattr(innerob,"aq_parent"):
+                inner = getattr(innerob, 'aq_inner', innerob)
+                parent = getattr(inner, 'aq_parent', None)
+                if parent is not None:
+                    innerob = parent
+                else:
+                    if hasattr(innerob, 'im_self'):
+                        innerob = innerob.im_self
+                        innerob = getattr(innerob, 'aq_inner', innerob)
+                if hasattr(innerob,"__allow_groups__"):
+                    userfolder=innerob.__allow_groups__
+                    if hasattr(userfolder,"validate"):
+                        user=userfolder.validate(request,auth,roles)
+                        if user is not None:
+                            return user
+                        
+            # No validation in upper user folders: Make a challenge
+            challengers = plugins.listPlugins(IChallengePlugin)
+            if challengers:
+                # We just pick the first one
+                challenger_id, challenger = challengers[0] 
+                try:
+                    return challenger.challenge(request, request.RESPONSE)
+                except _SWALLOWABLE_PLUGIN_EXCEPTIONS:
+                    LOG('PluggableAuthService', WARNING, 
+                        'ChallengePlugin %s error' % challenger_id,
+                        error=sys.exc_info())
+            
             return None
 
         #



More information about the Zope-CVS mailing list