FEATURE: only allow sidekiq in master site when hosted on multisite
This commit is contained in:
parent
b300d60086
commit
e84d5549ef
|
@ -20,7 +20,8 @@ Discourse::Application.routes.draw do
|
|||
mount Sidekiq::Web => "/sidekiq"
|
||||
mount Logster::Web => "/logs"
|
||||
else
|
||||
mount Sidekiq::Web => "/sidekiq", constraints: AdminConstraint.new
|
||||
# only allow sidekie in master site
|
||||
mount Sidekiq::Web => "/sidekiq", constraints: AdminConstraint.new(require_master: true)
|
||||
mount Logster::Web => "/logs", constraints: AdminConstraint.new
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,12 @@ require_dependency 'current_user'
|
|||
|
||||
class AdminConstraint
|
||||
|
||||
def initialize(options={})
|
||||
@require_master = options[:require_master]
|
||||
end
|
||||
|
||||
def matches?(request)
|
||||
return false if @require_master && RailsMultisite::ConnectionManagement.current_db != "default"
|
||||
provider = Discourse.current_user_provider.new(request.env)
|
||||
provider.current_user && provider.current_user.admin?
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue