Too easy! Thanks for the help David - I'll msg the channel when the app is on github. Fine job with Lift - it's been a joy so far!
David Pollak wrote: > > > On Mon, Jul 13, 2009 at 8:57 PM, Chris Lewis <burningodzi...@gmail.com > <mailto:burningodzi...@gmail.com>> wrote: > > > That'll get me started. User there however, must mixin MegaProtoUser > instead of ProtoUser right (getting compilation errors)? > > > Yeah... you have to build your User from MegaProtoUser/MetaMegaProtoUser. > > > > > I guess I'm interested in how/when/where the checking happens, but that > suggests I need to have a source dive. I do need secured pages in the > SiteMenu (which I can have once I work out the compilation issues), but > what if I need to secure a URL handled via custom dispatch, and so is > not in the menu? > > > Sitemap is for protecting XHTML pages... stuff that's rendered to the > browser. > > If you have a custom dispatch, then you have to build the protection > logic into the dispatch: > > case Req("my_page" :: "thing" :: Nil, _, GetRequest) if User.loggedIn_? > => () => XmlResponse(<hello>world</hello>) > > > > A little bonus of the app is a bookmarklet that > actually makes it useful, and it hits up that URL. The idea would be to > secure that URL in lift and if the user is logged it would just work. > > I'll hack on it a bit more tomorrow - thanks again! > > chris > > David Pollak wrote: > > In Boot.scala, define your SiteMap as: > > > > // Build SiteMap > > val entries = Menu(Loc("Home", List("index"), "Home")) :: > > Menu(Loc("Protected", List("protected"), "Protected", > > If(User.loggedIn_? _, "You must be loggd in to view this page"))) :: > > User.sitemap > > > > > > Note the "If()" clause that tests if the user is logged in and > will not > > display the menu item or let you access that page. > > > > Is this what you're looking for? > > > > On Mon, Jul 13, 2009 at 8:23 PM, Chris Lewis > <burningodzi...@gmail.com <mailto:burningodzi...@gmail.com> > > <mailto:burningodzi...@gmail.com > <mailto:burningodzi...@gmail.com>>> wrote: > > > > > > Hello list, > > > > I'm writing a lift app for a presentation Wednesday. It's a > simple > > little app that is all but done, missing only the ability to > secure > > pages. I've got a /really/ simple registration page (template > with a > > user name field, bound in a snippet that persists the User > model). > > What's missing is the ability to secure pages if the user is > logged in. > > I'm reading through the lift book and I just don't see in > there how it's > > done. > > > > FWIW, I'm working with lift 1.0. I switched to 1.1-SNAPSHOT > and there > > were some strange query-related breakages, so for the sake of > the demo > > I'll stick with 1.0. I'm sorry if this question has been > asked 1000 > > times - can anyone offer a good resource or example (logins, > logouts, > > secured pages)? > > > > Thanks! Lift is pretty cool so far :) - I'll github the app > after it's > > to a workable state. Should be a decent example of ProtoUser > usage and a > > few other simple things (like a LastFM api using dbDispatch). > > > > chris > > > > > > > > > > > > -- > > Lift, the simply functional web framework http://liftweb.net > > Beginning Scala http://www.apress.com/book/view/1430219890 > > Follow me: http://twitter.com/dpp > > Git some: http://github.com/dpp > > > > > > > > > > > -- > Lift, the simply functional web framework http://liftweb.net > Beginning Scala http://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 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 -~----------~----~----~----~------~----~------~--~---