def user_is_allowed(resource, action, json = false)
      if !logged_in?
        if json
          render :json => false
        else
          redirect_to "/login?return_url=" + URI.encode(request.fullpath)
        end
        return false
      end
      
      @user = logged_in_user
      if !@user.is_allowed(resource, action)        
        if json
          render :json => false
        else
          @error = "You don't have permission to " + action + " " + resource
          @return_url = request.fullpath
          render :template => "caboose/extras/error"
        end
        return false
      end
      
      return true    
    end
def user_is_allowed(resource, action, json = false)
      if !logged_in?
        if json
          render :json => false
        else
          redirect_to "/login?return_url=" + URI.encode(request.fullpath)
        end
        return false
      end
      
      @user = logged_in_user
      if !@user.is_allowed(resource, action)        
        if json
          render :json => false
        else
          @error = "You don't have permission to " + action + " " + resource
          @return_url = request.fullpath
          render :template => "caboose/extras/error"
        end
        return false
      end
      
      return true    
    end
DEPRECATED: Use user_is_allowed_to(action, resource)

 Checks to see if a user has permission to perform the given action
 on the given resource.
 Redirects to login if not logged in.
 Redirects to error page with message if not allowed.