Re: [Zope] Re: access rule and authentication
> -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Krzysztof Kubacki wrote: > > Hi, > > > > Python Script which is set as "Access Rule" for some Folder is > > execute before authentication is done. > > This way the following code won't work> > > if context.portal_membership.getAuthenticatedUser().getId() == "admin": > > return "dog" > > return "cat" > > > > I will always get "cat". So does somebody know how to resolve it? > > AcceseRules run during path traversal, before any authentication is done > (Zope2 does "inside out" authentication starting at the "published" > objectd). You might be able to force user validation to be attempted > earlier, e.g. by calling 'validate' directly on the user folder. > How do do it? Any code example? REQUEST = context.REQUEST user_obj = UserFolder() user = user_obj.validate(REQUEST) Does not work Regards KK ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Re: access rule and authentication
Tres Seaver wrote: AcceseRules run during path traversal, before any authentication is done (Zope2 does "inside out" authentication starting at the "published" objectd). You might be able to force user validation to be attempted earlier, e.g. by calling 'validate' directly on the user folder. Didn't someone add a post-authentication hook for this kind of thing? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )