[CMF-checkins] CVS: CMF/DCWorkflow - Guard.py:1.12

Zachery Bir zbir at urbanape.com
Tue Mar 16 22:00:51 EST 2004


Update of /cvs-repository/CMF/DCWorkflow
In directory cvs.zope.org:/tmp/cvs-serv30753

Modified Files:
	Guard.py 
Log Message:
provide for the current behavior when used with base_cms, and prepare
for use with PluggableAuthService, defaulting, in the absence of
either to an empty tuple.


=== CMF/DCWorkflow/Guard.py 1.11 => 1.12 ===
--- CMF/DCWorkflow/Guard.py:1.11	Thu Feb 12 03:58:34 2004
+++ CMF/DCWorkflow/Guard.py	Tue Mar 16 22:00:50 2004
@@ -67,12 +67,18 @@
         if self.groups:
             # Require at least one of the specified groups.
             u = sm.getUser()
-            if hasattr(aq_base(u), 'getContextualGroupMonikers'):
-                u_groups = u.getContextualGroupMonikers(ob)
+            b = aq_base( u )
+            if hasattr( b, 'getContextualGroupMonikers' ):
+                u_groups = u.getContextualGroupMonikers( ob )
+            elif hasattr( b, 'getGroupsInContext' ):
+                u_groups = u.getGroupsInContext( ob )
+            elif hasattr( b, 'getGroups' ):
+                u_groups = u.getGroups()
             else:
                 u_groups = ()
             for group in self.groups:
-                if ('(Group) %s' % group) in u_groups:
+                if ( group in u_groups
+                  or '(Group) %s' % group in u_groups ):
                     break
             else:
                 return 0




More information about the CMF-checkins mailing list