From e2671babf59ef20e97c8bd14dd9e28c3612349d9 Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Wed, 11 Mar 2015 15:11:07 +0500 Subject: [PATCH] add ENV variable for the post-receive hook --- lib/plugins/grack/auth.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/plugins/grack/auth.rb b/lib/plugins/grack/auth.rb index 1493c74fb..cafdc4cbd 100644 --- a/lib/plugins/grack/auth.rb +++ b/lib/plugins/grack/auth.rb @@ -11,10 +11,11 @@ module Grack return render_not_found if project.blank? return ::Rack::Auth::Basic.new(@app) do |u, p| - user = User.auth_by_token_or_login_pass(u, p) and - ability = ::Ability.new(user) and ability.can?(action, project) and - ENV['GL_ID'] = "user-#{user.id}" - end.call(env) unless project.public? and read? # need auth + user = User.auth_by_token_or_login_pass(u, p) && + ability = ::Ability.new(user) && ability.can?(action, project) && + ENV['GL_ID'] = "user-#{user.id}" && + ENV['GL_REPO_PATH'] = project.path + end.call(env) unless project.public? && read? # need auth end @app.call(env) # next app in stack end