Permalink
Browse files

Refactoring hasAnyRoles method

  • Loading branch information...
1 parent 6c52e5f commit 95ccd4ad2060a1227fb161b8f80705a4fa733113 @lunserv lunserv committed Sep 22, 2011
Showing with 2 additions and 4 deletions.
  1. +2 −4 library/src/main/scala/shiro/utils.scala
@@ -36,10 +36,8 @@ 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]) =
+ roles exists (r => hasRole(r.trim))
}
import net.liftweb.common.{Box,Failure,Full}

0 comments on commit 95ccd4a

Please sign in to comment.