[Zope] Re: access rule and authentication
Krzysztof Kubacki
krzysztof.kubacki at bmpg.pl
Tue Oct 18 06:10:04 EDT 2005
> -----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
More information about the Zope
mailing list