Thanks for the assistance David, and to suresk in the IRC channel as well as tjweir (I was pointed to his example code). My app is where I wanted it for the demo. This week and next will be pretty slamming at work, but I will try to find some time to push the app to github soon.
sincerely, chris David Pollak wrote: > > > On Tue, Jul 14, 2009 at 3:32 PM, Chris Lewis <burningodzi...@gmail.com > <mailto:burningodzi...@gmail.com>> wrote: > > > I guess the first question I should have asked is how do I go about > logging a user in. I have my user model, which now mixes in > MegaProtoUser. I also persist instances, but I don't know how to "start" > a user session. I noticed the logUserIn method - I assume that's where > to start when I get back into the app later this evening, but I was > wondering if there are any example apps that use this? I didnt see any > in the current source, and, assuming it makes a difference, I'm > using 1.0. > > thanks again, > chris > > > Chris, > > Did you start your app based on one of the Lift templates? > > If you take a look at line 27 of: > http://github.com/dpp/lift_1_1_sample/blob/master/src/main/scala/bootstrap/liftweb/Boot.scala > > You'll see how the MegaProtoUser can manage its own menus. From that, > you get login, logout, etc. > > Does this help? > > Thanks, > > David > > > > > David Pollak wrote: > > > > > > On Tue, Jul 14, 2009 at 9:20 AM, glenn <gl...@exmbly.com > <mailto:gl...@exmbly.com> > > <mailto:gl...@exmbly.com <mailto:gl...@exmbly.com>>> wrote: > > > > > > I do something similar in menu items to hide them for > different user > > roles, but > > the error message: No Navigation Defined, is displayed if the > right > > user isn't logged in. > > How do I turn this off? > > > > > > Upgrade based on the fix I just checked in. :-) > > > > > > > > > > > > On Jul 14, 4:02 am, Chris Lewis <burningodzi...@gmail.com > <mailto:burningodzi...@gmail.com> > > <mailto:burningodzi...@gmail.com > <mailto:burningodzi...@gmail.com>>> wrote: > > > 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> > <mailto:burningodzi...@gmail.com <mailto:burningodzi...@gmail.com>> > > > > <mailto:burningodzi...@gmail.com > <mailto:burningodzi...@gmail.com> > > <mailto: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>> > > <mailto:burningodzi...@gmail.com > <mailto:burningodzi...@gmail.com> <mailto:burningodzi...@gmail.com > <mailto:burningodzi...@gmail.com>>> > > > > > <mailto:burningodzi...@gmail.com > <mailto:burningodzi...@gmail.com> > > <mailto:burningodzi...@gmail.com > <mailto:burningodzi...@gmail.com>> > > > > <mailto: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 > > frameworkhttp://liftweb.net <http://liftweb.net> > <http://liftweb.net> > > > > > Beginning > > Scalahttp://www.apress.com/book/view/1430219890 > <http://www.apress.com/book/view/1430219890> > > <http://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 <http://liftweb.net> > > <http://liftweb.net> > > > > Beginning > Scalahttp://www.apress.com/book/view/1430219890 > <http://www.apress.com/book/view/1430219890> > > <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 > > > > > > > > > > > -- > 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 -~----------~----~----~----~------~----~------~--~---