[Zope-Checkins] CVS: Zope2 - User.py:1.153

chrism@serenade.digicool.com chrism@serenade.digicool.com
Tue, 3 Jul 2001 16:20:00 -0400


Update of /cvs-repository/Zope2/lib/python/AccessControl
In directory serenade:/home/chrism/BackTalk/lib/python/AccessControl

Modified Files:
	User.py 
Log Message:
Added domainAuthModeEnabled method used by dtml files.

Corrected domainSpecValidate method... it was previously failing due to improper dependency of the addr_match and host_match regexes returning an integer.



--- Updated File User.py in package Zope2 --
--- User.py	2001/06/07 22:36:43	1.152
+++ User.py	2001/07/03 20:19:00	1.153
@@ -753,8 +753,15 @@
     def domainSpecValidate(self, spec):
         for ob in spec:
             sz=len(ob)
-            if not ((addr_match(ob) == sz) or (host_match(ob) == sz)):
-                return 0
+            am = addr_match(ob)
+            hm = host_match(ob)
+            if am or hm:
+                if am: am = am.end()
+                else: am = -1
+                if hm: hm = hm.end()
+                else: hm = -1
+                if not ( (am == sz) or (hm == sz) ):
+                    return 0
         return 1
 
     def _addUser(self,name,password,confirm,roles,domains,REQUEST=None):
@@ -911,8 +918,9 @@
         v = self._domain_auth_mode = domain_auth_mode and 1 or 0
         return 'Domain authentication mode set to %d' % v
 
-
-
+    def domainAuthModeEnabled(self):
+        """ returns true if domain auth mode is set to true"""
+        return getattr(self, '_domain_auth_mode', None)
 
 class UserFolder(BasicUserFolder):
     """Standard UserFolder object