Ruby on rails 延迟web gem的自定义身份验证检查?

Ruby on rails 延迟web gem的自定义身份验证检查?,ruby-on-rails,rubygems,rails-authorization,Ruby On Rails,Rubygems,Rails Authorization,目前我正在我的项目中使用gemdelayed-web。我有多个用户角色,我不希望角色是销售的用户可以访问页面延迟web后台界面。我已经有了一个方法来检查我的应用程序控制器中的身份验证。但是,我不知道如何使它在路由文件中工作。如有任何建议,将不胜感激 更新:我没有使用Desive gem。我自己进行身份验证 应用程序\u控制器.rb: class ApplicationController < ActionController::Base # Prevent CSRF attacks b

目前我正在我的项目中使用gem
delayed-web
。我有多个用户角色,我不希望角色是销售的用户可以访问页面延迟web后台界面。我已经有了一个方法来检查我的应用程序控制器中的身份验证。但是,我不知道如何使它在路由文件中工作。如有任何建议,将不胜感激

更新:我没有使用Desive gem。我自己进行身份验证

应用程序\u控制器.rb

class ApplicationController < ActionController::Base
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  protect_from_forgery with: :exception

  before_action :authenticate
  before_action :check_pricer_role, except: [:export_for_customer]
  helper_method :check_pricer_role
 def check_pricer_role
    unless current_user && (current_user.pricer? || current_user.admin?)
      redirect_to errors_not_found_path
    end
  end
end
Rails.application.routes.draw do
  # How to apply the defined authentication here?
  mount Delayed::Web::Engine, at: '/jobs'
end

好的,我已经解决了这个问题。事实证明,我可以根据保存在请求对象内部的身份验证令牌找到当前用户(同样,我不使用任何gem进行身份验证,我使用自己的gem,但我认为这不是问题所在)。 这是一个完整的解决方案,以防有人遇到同样的困难:

    class AuthConstraint
      def matches?(request)
        current_user ||= User.find_by_auth_token(request.cookie_jar['auth_token']) if request.cookie_jar['auth_token']
         current_user.present? && !current_user.sales?
      end
    end

    Rails.application.routes.draw do
        mount Delayed::Web::Engine, at: '/jobs', :constraints => AuthConstraint.new
        //Other resources ........ 
    end

您使用的是
designe
gem还是其他?@AlexKojin谢谢,但我的项目中没有使用designe gem。如何验证用户身份?按时段?重要的是要了解他们的角色。我想问题中已经提到了。