diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-06-29 04:53:43 -0700 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-06-29 04:53:43 -0700 |
commit | f73d71810e4d9fb095d945d8473d2c19d1b0badc (patch) | |
tree | 6ff86081f0577d00033ac90359915f0e8cbb8492 /config/initializers | |
parent | cfee2fc9e4a07f1aca7df369e3a6f39856193b3f (diff) | |
parent | 2da45e9cbf8bf0db88274451ba9dc61db50c571d (diff) | |
download | gitlab-ce-f73d71810e4d9fb095d945d8473d2c19d1b0badc.tar.gz |
Merge pull request #1018 from glebm/master
Resque Authentication + iFrame view
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/protect_resque.rb | 5 | ||||
-rw-r--r-- | config/initializers/resque_authentication.rb | 14 |
2 files changed, 14 insertions, 5 deletions
diff --git a/config/initializers/protect_resque.rb b/config/initializers/protect_resque.rb deleted file mode 100644 index d52815ffa9c..00000000000 --- a/config/initializers/protect_resque.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'resque/server' -Resque::Server.use(Rack::Auth::Basic) do |user, password| - user == "gitlab" - password == "5iveL!fe" -end diff --git a/config/initializers/resque_authentication.rb b/config/initializers/resque_authentication.rb new file mode 100644 index 00000000000..a439d322804 --- /dev/null +++ b/config/initializers/resque_authentication.rb @@ -0,0 +1,14 @@ +require 'resque/server' +class Authentication + def initialize(app) + @app = app + end + + def call(env) + account = env['warden'].authenticate!(:database_authenticatable, :rememberable, scope: :user) + raise "Access denied" if !account.admin? + @app.call(env) + end +end + +Resque::Server.use Authentication
\ No newline at end of file |