提交 15640746 编写于 作者: J Jacob Vosmaer

Refactor _allowed? methods as Rémy asked

上级 3ffa494f
......@@ -128,26 +128,20 @@ class Projects::GitHttpController < Projects::ApplicationController
end
def upload_pack_allowed?
if !Gitlab.config.gitlab_shell.upload_pack
false
elsif ci?
true
elsif user
return false unless Gitlab.config.gitlab_shell.upload_pack
if user
Gitlab::GitAccess.new(user, project).download_access_check.allowed?
else
project.public?
ci? || project.public?
end
end
def receive_pack_allowed?
if !Gitlab.config.gitlab_shell.receive_pack
false
elsif user
return false unless Gitlab.config.gitlab_shell.receive_pack
# Skip user authorization on upload request.
# It will be done by the pre-receive hook in the repository.
true
else
false
end
user.present?
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册