Permalink
Browse files

Corrected to previous commit and add RequireRemembered for logout menu

  • Loading branch information...
1 parent 35d19ef commit d32ab96e2f6b2e424ac881739638d7ac657cc4ea @lunserv lunserv committed Sep 20, 2011
Showing with 8 additions and 6 deletions.
  1. +3 −3 library/src/main/scala/shiro/sitemap/locs.scala
  2. +5 −3 library/src/main/scala/shiro/utils.scala
@@ -41,16 +41,16 @@ object Locs {
() => isRemembered || isAuthenticated,
() => RedirectBackToReferrer)
- val RequireNoRemembered = If(
+ val RequireNotRemembered = If(
() => !(isRemembered || isAuthenticated),
() => RedirectToIndexURL)
def logoutMenu = Menu(Loc("Logout", logoutURL,
S.??("logout"), logoutLocParams))
- private val logoutLocParams = RequireAuthentication ::
+ private val logoutLocParams = RequireRemembered ::
EarlyResponse(() => {
- if(isAuthenticated){ subject.logout() }
+ if(isAuthenticated || isRemembered){ subject.logout() }
Full(RedirectResponse(Shiro.indexURL.vend))
}) :: Nil
@@ -32,8 +32,10 @@ private[shiro] trait Utils {
def lacksPermission(permission: String) =
!hasPermission(permission)
- def hasAnyRoles(roles: Seq[String]) =
- test { subject => roles.map(r => subject.hasRole(r.trim)).contains(true) }
+ def hasAnyRoles(roles: Seq[String]) = test { subject =>
+ roles.map(r => subject.hasRole(r.trim)
+ ).contains(true)
+ }
}
import net.liftweb.common.{Box,Failure,Full}
@@ -48,7 +50,7 @@ trait SubjectLifeCycle {
protected def logout() = subject.logout
- protected def login[T <: AuthenticationToken](token: T) {
+ protected def login[T <: AuthenticationToken](token: T){
def redirect = S.redirectTo(LoginRedirect.is.openOr("/"))
if(!isAuthenticated){

0 comments on commit d32ab96

Please sign in to comment.