Search code examples
scalasitemaplift

How can i change my sitemap after the boot.scala executed


I'm just learning lift by doing a sample app in lift. i want to show a login page and some other pages if user logged in. so how can i add those page links to the already existing sitemap in left side of my master page and remove some page links also. I know that the siteMap will set in the boot.scala file but how can i modify that after executing that. can anybody give me an idea.

Thanxx..!!


Solution

  • Modify the site map, add entries that look like Menu.i("smth") / "myPath" >> If(() => userIsLoggedIn, "error")

    this way, if the user is not logged in, he will not see the menu entry (and woudn't be able to access). If he's logged in, he'll see the menu entry. Example: http://simply.liftweb.net/index-3.2.html#toc-Subsection-3.2.4

    There are also Site Mutators (I don't understand how they work from the inside): https://github.com/lift/lift_25_sbt/blob/master/scala_29/lift_basic/src/main/scala/bootstrap/liftweb/Boot.scala#L53