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

Zachery Bir zbir at urbanape.com
Wed Mar 31 18:25:06 EST 2004


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

Modified Files:
	Guard.py 
Log Message:
provide for alternative group implementations: 

  <user>.getGroupsInContext( ob ) returns a list of group ids
    predicated on some attribute of ob (similar in nature to
    <user>.getRolesInContext( ob )

  <user>.getGroups() returns a list of groups of which the user is a
    member (similar in nature to global roles: <user>.getRoles())




=== CMF/DCWorkflow/Guard.py 1.13 => 1.14 ===
--- CMF/DCWorkflow/Guard.py:1.13	Wed Mar 17 09:00:38 2004
+++ CMF/DCWorkflow/Guard.py	Wed Mar 31 18:25:05 2004
@@ -67,12 +67,15 @@
         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, '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:
                     break
             else:
                 return 0




More information about the CMF-checkins mailing list