add ENV variable for the post-receive hook
This commit is contained in:
parent
535ef43364
commit
e2671babf5
|
@ -11,10 +11,11 @@ module Grack
|
||||||
return render_not_found if project.blank?
|
return render_not_found if project.blank?
|
||||||
|
|
||||||
return ::Rack::Auth::Basic.new(@app) do |u, p|
|
return ::Rack::Auth::Basic.new(@app) do |u, p|
|
||||||
user = User.auth_by_token_or_login_pass(u, p) and
|
user = User.auth_by_token_or_login_pass(u, p) &&
|
||||||
ability = ::Ability.new(user) and ability.can?(action, project) and
|
ability = ::Ability.new(user) && ability.can?(action, project) &&
|
||||||
ENV['GL_ID'] = "user-#{user.id}"
|
ENV['GL_ID'] = "user-#{user.id}" &&
|
||||||
end.call(env) unless project.public? and read? # need auth
|
ENV['GL_REPO_PATH'] = project.path
|
||||||
|
end.call(env) unless project.public? && read? # need auth
|
||||||
end
|
end
|
||||||
@app.call(env) # next app in stack
|
@app.call(env) # next app in stack
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue