moderation routes require moderation status

This commit is contained in:
nilsding 2014-12-26 13:46:47 +01:00
parent 96a298b8c2
commit 755bbac2d7
1 changed files with 9 additions and 2 deletions

View File

@ -1,14 +1,21 @@
require 'sidekiq/web' require 'sidekiq/web'
Rails.application.routes.draw do Rails.application.routes.draw do
get 'moderation/index' # Admin panel
mount RailsAdmin::Engine => '/justask_admin', as: 'rails_admin' mount RailsAdmin::Engine => '/justask_admin', as: 'rails_admin'
# Sidekiq
constraints ->(req) { req.env["warden"].authenticate?(scope: :user) && constraints ->(req) { req.env["warden"].authenticate?(scope: :user) &&
req.env['warden'].user.admin? } do req.env['warden'].user.admin? } do
mount Sidekiq::Web, at: "/sidekiq" mount Sidekiq::Web, at: "/sidekiq"
end end
# Moderation panel
constraints ->(req) { req.env['warden'].authenticate?(scope: :user) &&
(req.env['warden'].user.admin? or req.env['warden'].user.moderator?) } do
match '/moderation', to: 'moderation#index', via: :get, as: :moderation
end
root 'static#index' root 'static#index'
match '/about', to: 'static#about', via: 'get' match '/about', to: 'static#about', via: 'get'