On 23 Jun 2009, David Pollak wrote:

> Jeppe, I just checked in code (it'll take 45 minutes to hit the Maven
> repo) that has global LocParams for each SiteMap.  The SiteMap
> constructor is now:
> 
> SiteMap(globalParamFuncs: List[PartialFunction[Box[Req],
> Loc.LocParam]], kids: Menu*)
> 
> You can put your Redirect stuff in like:
> 
> List({
> case _ if !User.loggedIn_? => ...
> })

Brilliant! Works nicely. I ended up with this

  val menuDispatch:List[PartialFunction[Box[Req], Loc.LocParam]] = List({
       case Full(Req("profile" :: "login" :: Nil , _, _)) => Hidden
       case Full(Req("profile" :: "lost_password" :: Nil , _, _)) => Hidden
       case Full(Req(_, _, _)) if !User.loggedIn_? => Loc.EarlyResponse(() => 
Full(RedirectResponse("/profile/login?returnTo="+S.uri))) 
    })

A couple of questions:

1) Why the need for Box[Req]? When will it be Empty?  

2) In the above I had to use Hidden as a dummy value to signal no
Loc. It might be useful with a Box[Loc.LocParam] as return value?

/Jeppe


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to