SiteMap/Menu security question

64 views
Skip to first unread message

Noah Nordrum

unread,
Apr 26, 2011, 6:39:45 PM4/26/11
to Lift
I'm assuming that most people here are developing apps that require
security on the VAST majority of their pages, and I was wondering if
there was a relatively simple way to default to requires login (def
MustBeLoggedIn = If(() => User.loggedIn_?, () =>
RedirectResponse(User.loginPageURL)), or whatever), and just flag the
Menu items that don't require login.

Thanks!

Noah

Mahmood Ali

unread,
Apr 26, 2011, 9:09:06 PM4/26/11
to lif...@googlegroups.com
SiteMap has a globalParamFunc parameter where you can insert a global
LocParam. I have the following snippet work for me:

LiftRules.setSiteMap(new SiteMap(List({ case r =>
If(() => r match {
case Full(Req("user_mgt" :: _, _, _)) => true
case _ => User.loggedIn_?
}, RedirectResponse("/user_mgt/login"))
}), entries:_*))

I wonder if there is a more efficient to use Groups and LocParams though.

- Mahmood

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

David Pollak

unread,
May 13, 2011, 8:03:49 AM5/13/11
to lif...@googlegroups.com
On Wed, Apr 27, 2011 at 3:09 AM, Mahmood Ali <not...@gmail.com> wrote:
SiteMap has a globalParamFunc parameter where you can insert a global
LocParam.  I have the following snippet work for me:

  LiftRules.setSiteMap(new SiteMap(List({ case r =>
    If(() => r match {
        case Full(Req("user_mgt" :: _, _, _)) => true
        case _ => User.loggedIn_?
      }, RedirectResponse("/user_mgt/login"))
  }), entries:_*))

I wonder if there is a more efficient to use Groups and LocParams though.

That's an interesting idea.  Can you open a ticket on relating to this thread.  I'll noodle on some partial functions that might allow adding additional LocParams to Locs that have particular matching LocParams (like Group or something else).
 

- Mahmood

On Tue, Apr 26, 2011 at 6:39 PM, Noah Nordrum <nnor...@ideafidelity.com> wrote:
> I'm assuming that most people here are developing apps that require
> security on the VAST majority of their pages, and I was wondering if
> there was a relatively simple way to default to requires login (def
> MustBeLoggedIn = If(() => User.loggedIn_?, () =>
> RedirectResponse(User.loginPageURL)), or whatever), and just flag the
> Menu items that don't require login.
>
> Thanks!
>
> Noah
>
> --
> You received this message because you are subscribed to the Google Groups "Lift" group.
> To post to this group, send email to lif...@googlegroups.com.
> To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
>
>

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




--
Lift, the simply functional web framework http://liftweb.net
Reply all
Reply to author
Forward
0 new messages