Commit 957edb13 authored by Michael Kozono's avatar Michael Kozono

Refactor to let `GitAccess` check protocol config

This already works due to previous refactoring.
parent 9d78f835
...@@ -10,8 +10,6 @@ class Projects::GitHttpController < Projects::GitHttpClientController ...@@ -10,8 +10,6 @@ class Projects::GitHttpController < Projects::GitHttpClientController
render_ok render_ok
elsif receive_pack? && receive_pack_allowed? elsif receive_pack? && receive_pack_allowed?
render_ok render_ok
elsif http_blocked?
render_http_not_allowed
else else
render_denied render_denied
end end
...@@ -62,10 +60,6 @@ class Projects::GitHttpController < Projects::GitHttpClientController ...@@ -62,10 +60,6 @@ class Projects::GitHttpController < Projects::GitHttpClientController
render json: Gitlab::Workhorse.git_http_ok(repository, wiki?, user, action_name) render json: Gitlab::Workhorse.git_http_ok(repository, wiki?, user, action_name)
end end
def render_http_not_allowed
render plain: access_check.message, status: :forbidden
end
def render_denied def render_denied
if access_check.message == Gitlab::GitAccess::ERROR_MESSAGES[:project_not_found] if access_check.message == Gitlab::GitAccess::ERROR_MESSAGES[:project_not_found]
render plain: access_check.message, status: :not_found render plain: access_check.message, status: :not_found
...@@ -93,10 +87,6 @@ class Projects::GitHttpController < Projects::GitHttpClientController ...@@ -93,10 +87,6 @@ class Projects::GitHttpController < Projects::GitHttpClientController
@access_check ||= access.check(git_command, '_any') @access_check ||= access.check(git_command, '_any')
end end
def http_blocked?
!access.protocol_allowed?
end
def receive_pack_allowed? def receive_pack_allowed?
access_check.allowed? access_check.allowed?
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment