public synchronized boolean isUserInRole ( Principal user , String roleName ) { if ( user instanceof WrappedUser ) return ( ( WrappedUser ) user ) . isUserInRole ( roleName ) ; if ( user == null || ( ( User ) user ) . getUserRealm ( ) != this ) return false ; HashSet userSet = ( HashSet ) _roles . get ( roleName ) ; return userSet != null && userSet . contains ( user . getName ( ) ) ; }
Check if a user is in a role .