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

Chris Withers lists at simplistix.co.uk
Wed Mar 17 03:41:24 EST 2004


What's base_cms?

What's PluggableAuthService?

Why are there no tests for this?!

Chris


Zachery Bir wrote:

> 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
> 
> 
> _______________________________________________
> CMF-checkins mailing list
> CMF-checkins at zope.org
> http://mail.zope.org/mailman/listinfo/cmf-checkins
> 

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




More information about the CMF-checkins mailing list