0
現在、私のプロジェクトではdelayed-web
という宝石を使用しています。私は複数のユーザーの役割を持っている、と私はユーザーの役割を販売したいとは思わないWebページの遅延インターフェイスにアクセスすることができますインターフェイス。私はすでにアプリケーションコントローラの認証をチェックする方法を持っています。しかし、私はルートファイルでそれを動作させる方法を知らない。どんな提案もありがとうございます。遅延ウェブ宝石のカスタム認証チェック?
:Devise gemを使用していません。私は自分の認証をロールバックします。
application_controller.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
routes.rbを:
Rails.application.routes.draw do
# How to apply the defined authentication here?
mount Delayed::Web::Engine, at: '/jobs'
end
あなたは 'Devise'宝石やその他を使用していますか? –
@AlexKojinありがとうございますが、プロジェクトでDevise宝石を使用していません。 –
ユーザーを認証する方法は?セッションごとに?詳細を知ることが重要です –