Commit 2da45e9cbf8bf0db88274451ba9dc61db50c571d
1 parent
3a4aff69
Exists in
master
and in
4 other branches
Refs #1013
Renamed protect_resque.rb => resque_authentication Integrated resque web with the rest of gitlab
Showing
7 changed files
with
28 additions
and
11 deletions
Show diff stats
app/views/admin/dashboard/index.html.haml
app/views/layouts/admin.html.haml
| ... | ... | @@ -6,10 +6,10 @@ |
| 6 | 6 | = render "layouts/head_panel", :title => "Admin area" |
| 7 | 7 | .container |
| 8 | 8 | %nav.main_menu |
| 9 | - = link_to "Stats", admin_root_path, :class => "home #{controller.controller_name == "dashboard" ? "current" : nil}" | |
| 10 | - = link_to "Projects", admin_projects_path, :class => controller.controller_name == "projects" ? "current" : nil | |
| 11 | - = link_to "Users", admin_users_path, :class => controller.controller_name == "users" ? "current" : nil | |
| 12 | - = link_to "Emails", admin_emails_path, :class => controller.controller_name == "mailer" ? "current" : nil | |
| 13 | - = link_to "Resque", "/info/resque" | |
| 9 | + = link_to "Stats", admin_root_path, :class => "home #{'current' if controller.controller_name == "dashboard"}" | |
| 10 | + = link_to "Projects", admin_projects_path, :class => ('current' if controller.controller_name == "projects") | |
| 11 | + = link_to "Users", admin_users_path, :class => ('current' if controller.controller_name == 'users') | |
| 12 | + = link_to "Emails", admin_emails_path, :class => ('current' if controller.controller_name == 'mailer') | |
| 13 | + = link_to "Resque", admin_resque_path, :class => ('current' if controller.controller_name == 'resque') | |
| 14 | 14 | |
| 15 | 15 | .content= yield | ... | ... |
config/initializers/protect_resque.rb
| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | +require 'resque/server' | |
| 2 | +class Authentication | |
| 3 | + def initialize(app) | |
| 4 | + @app = app | |
| 5 | + end | |
| 6 | + | |
| 7 | + def call(env) | |
| 8 | + account = env['warden'].authenticate!(:database_authenticatable, :rememberable, scope: :user) | |
| 9 | + raise "Access denied" if !account.admin? | |
| 10 | + @app.call(env) | |
| 11 | + end | |
| 12 | +end | |
| 13 | + | |
| 14 | +Resque::Server.use Authentication | |
| 0 | 15 | \ No newline at end of file | ... | ... |
config/routes.rb