Skip to content
Extraits de code Groupes Projets
Valider 17b5e7b0 rédigé par Maxwell Salzberg's avatar Maxwell Salzberg
Parcourir les fichiers

move admin rack to its own file

parent 7ab963f8
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -30,24 +30,6 @@ end
if AppConfig[:mount_resque_web]
require 'resque/server'
class AdminRack
def initialize(app)
@app = app
end
def call(env)
user = env['warden'].authenticate(:scope => :user)
if user && user.admin?
@app.call(env)
else
[307, {"Location" => '/'}, self]
end
end
def each(&block)
end
end
require File.join(Rails.root, 'lib/admin_rack')
Resque::Server.use AdminRack
end
class AdminRack
def initialize(app)
@app = app
end
def call(env)
user = env['warden'].authenticate(:scope => :user)
if user && user.admin?
@app.call(env)
else
[307, {"Location" => '/'}, self]
end
end
def each(&block)
end
end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter