On Wed, Sep 30, 2009 at 1:51 PM, Ben Short <[email protected]> wrote:
> Can anyone give me an example of how to redirect a user to form based
> log in page when they try to access something that anonymous can't
> read?
There's one problem with that: If the user is not granted access
'something', that 'something' is invisible to the user. Thus, you
cannot distinguish between a 404 situation and a 401 (not authorized)
situation.
You might want to let 'something' be readable by all users, but hiding
all its subnodes. Then you can say that if 'something' does not have
an expected child node/property, you should redirect to the login
form:
<%
if (!currentNode.hasNodes()) {
response.sendRedirect("/loginform");
}
%>
--
Vidar S. Ramdal <[email protected]> - http://www.idium.no
Sommerrogata 13-15, N-0255 Oslo, Norway
+ 47 22 00 84 00 / +47 21 531941, ext 2070