David,

Pardon my ignorance, but I see a Test case class in the Lift 1.0 api
for Loc, but not TestAccess, which seems similar.

Glenn...

On May 13, 6:58 am, David Pollak <[email protected]>
wrote:
> Glenn,
>
> I've added another Loc param:
>
>   /**
>    * Allows extra access testing for a given menu location such that
>    * you can build a menu that is displayed but redirects the user to a
> login
>    * page if they are not logged in
>    */
>   case class TestAccess(func: () => Box[LiftResponse]) extends LocParam
>
> This will let you write a function that tests access for the page and return
> a RedirectResponse if the user needs to log in.  It will not impact the
> display of the menu item.
>
> Hope this helps.
>
> Thanks,
>
> David
>
>
>
> On Tue, May 12, 2009 at 5:23 PM, glenn <[email protected]> wrote:
>
> > Hmm,
>
> > Here's my complete menu list for this LocGroup:
>
> >  def quoteMenu:List[Menu] = {
> >      val groupquote = Menu(Loc("groupquote", List("quote", "group"),
> > "Group Quote", LocGroup("quote"), loggedIn ))
> >      val businessquote = Menu(Loc("businessquote", List("quote",
> > "business"), "Commercial Quote", LocGroup("quote")))
> >      val lifequote = Menu(Loc("lifequote", List("quote", "life"),
> > "Life Ins. Quote", LocGroup("quote")))
> >      val autoquote = Menu(Loc("autoquote", List("quote", "auto"),
> > "Auto Quote", LocGroup("quote")))
> >      val homequote = Menu(Loc("homequote", List("quote", "home"),
> > "Homeowners Quote", LocGroup("quote")))
> >      val medicarequote = Menu(Loc("medicarequote", List("quote",
> > "medicare"), "Medicare Sup. Quote", LocGroup("quote")))
> >      List
> > (groupquote,businessquote,lifequote,autoquote,homequote,medicarequote)
> >    }
>
> > I want to control page access so that  whenever the user clicks on one
> > of the above menu items and isn't logged they are redirected to the
> > login page. As I understand it, there are no submenus here, only
> > siblings. Where would I put the loggedIn function to make this work?
>
> > On May 12, 5:02 pm, David Pollak <[email protected]>
> > wrote:
> > > If a top-level menu item is not accessible, then none of its children are
> > > accessible.  SiteMap does not display any pages that are inaccessible.
>
> > > In the example, you've got all the menus controlled by the "loggedIn"
> > If()
> > > clause and that's blocking access to menu and thus the menu is not
> > > displayed.
>
> > > On Tue, May 12, 2009 at 4:54 PM, glenn <[email protected]> wrote:
>
> > > > I have a menu defined as follows:
>
> > > >  def quoteMenu:List[Menu] = {
> > > >      val groupquote = Menu(Loc("groupquote", List("quote", "group"),
> > > > "Group Quote",loggedIn, LocGroup("quote")))
> > > >      ....More menu items
> > > >    }
>
> > > > and an If LocParam to check if the user is logged in:
>
> > > > val loggedIn = If(() => User.loggedIn_?,
> > > > () => RedirectResponse("/login"))
>
> > > > When the sitemap is displayed, the menu item is not visible if the
> > > > user isn't logged in. This is not the behavior
> > > > expected. The user should be able to click on the menu item and be
> > > > redirected to the login page.
>
> > > > Any ideas as to what's going on here. Am I even using the right
> > > > mechanism to control page access?
>
> > > > Glenn...
>
> > > --
> > > Lift, the simply functional web frameworkhttp://liftweb.net
> > > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > > Follow me:http://twitter.com/dpp
> > > Git some:http://github.com/dpp
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Git some:http://github.com/dpp

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

Reply via email to