[Zope] REQUEST and AccessRule

Gilles Lenfant gilles at pilotsystems.net
Thu Oct 2 08:32:02 EDT 2003


----- Original Message ----- 
From: "Dieter Maurer" <dieter at handshake.de>
To: "Gilles Lenfant" <gilles at pilotsystems.net>
Cc: <zope at zope.org>
Sent: Wednesday, October 01, 2003 9:59 PM
Subject: Re: [Zope] REQUEST and AccessRule


> Gilles Lenfant wrote at 2003-10-1 18:12 +0200:
>  > It seems that REQUEST data available in a script executed as access rule are different from those usually available.
> 
> They are mostly the same:
> 
>   "AUTHENTICATED_USER" is not yet defined and "SESSION" may not
>   yet be defined.

Yes, the ZPublisher machinery seems to process security stuffs *after* pre traversal hooks like access rules.
And I didn't find how to tweak the execution order of those pre traversal hooks when they're in the same container (access rule, session machinery, localizer...)

>   "URL*" variables do not yet give the final results.
>   Not all "BASE*" variables are defined.
> 
>  > How can I find the ones available ?
> 
>  You could try "REQUEST.keys()"...

Evan Simpson (thanks again) gave me the enlightenment (out of Zope ML): acces rule scripts receive 2 parameters : the folderish that contains the access rule and the request (didn't see any mention to this is the docs).
Thus, such python scripts should contain...

...
##parameters=kontainer, request
...

So you can check the REQUEST content at that stage with this in that access rule script :

request.set('accessrulerequest', str(request))

...and show it in any ZPT or DTML.

> 
>  > In my case, I need to have the (external) hostname (running behind Apache and a VirtualHostMonster) in an access rule script.
> 
> Unless Apache puts this information into the environment, it
> is not available at all.
> Please read the Apache "mod_rewrite" documentation how to put
> some information into the environment.

I use the ZServer that can't access to Apache environment. I don't want to use the Zope CGI mode.
Anyway, I found what I wanted

Thanks Dieter

--
Gilles





More information about the Zope mailing list