sidekiq监控页面加权限

dev_forum
cxt 5 years ago
parent 041b2ea358
commit 2c143af774

@ -0,0 +1,7 @@
class AdminConstraint
def matches?(request)
return false unless request.session[:user_id]
user = User.find request.session[:user_id]
user && user.admin?
end
end

@ -1,7 +1,8 @@
Rails.application.routes.draw do
require 'sidekiq/web'
mount Sidekiq::Web => '/sidekiq'
require 'admin_constraint'
mount Sidekiq::Web => '/sidekiq', :constraints => AdminConstraint.new
resources :edu_settings
scope '/api' do

Loading…
Cancel
Save