I've never had any reason to do this so there might be a shortcut but I
think something along the lines of the following should work (As long as
your access/auth handler doesnt make use of $r->is_intial_req())

use Apache::Constants (:common);
my $subr   = $r->lookup_uri('/new/request/?foo=bar');
my $status = $subr->status;
my $ok     = $status==AUTH_REQUIRED ? 0:1;

Ric.

----- Original Message -----
From: "Jean-Michel Hiver" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 27, 2003 10:42 AM
Subject: Authorization question


> Hi List,
>
> In theory Authentication / Authorization handlers are very cool, because
> the application underneath it doesn't need to know the logic of it, and
> as long as you design web applications with nice, RESTful, sensible URIs
> it would all work beautifully.
>
> BUT, I cannot figure out how to 'ask' apache wether a request would
> succeed or not. I'm wondering wether there would be a way to do:
>
>   my $ok = $r->would_be_authorized ($uri);
>
>   # or
>   my $ok = $r->would_be_authorized ($uri, 'GET');
>
>   # or
>   my $ok = $r->would_be_authorized ($uri, 'POST', $fh);
>
>
> This would be handy because for example in your web application you
> might want certain controls or links to be replaced by proper messages
> rather than directing the user to a location that he/she doesn't have
> access to.
>
> If I missed something obvious please point out a URI so that I can RTFM!
> All ideas appreciated!
>
> Cheers,
> --
> Building a better web - http://www.mkdoc.com/
> ---------------------------------------------
> Jean-Michel Hiver
> [EMAIL PROTECTED]  - +44 (0)114 255 8097
> Homepage: http://www.webmatrix.net/
>
>
>

Reply via email to