Commit c98f89ea authored by Patricio Cano's avatar Patricio Cano

Simplify access checks

parent 8b14d1d2
...@@ -162,12 +162,18 @@ class Projects::GitHttpController < Projects::ApplicationController ...@@ -162,12 +162,18 @@ class Projects::GitHttpController < Projects::ApplicationController
return false unless Gitlab.config.gitlab_shell.upload_pack return false unless Gitlab.config.gitlab_shell.upload_pack
if user if user
Gitlab::GitAccess.new(user, project, 'http').download_access_check.allowed? access.allowed?
else else
ci? || project.public? ci? || project.public?
end end
end end
def access
return @access if defined?(@access)
@access = Gitlab::GitAccess.new(user, project, 'http').check('git-upload-pack')
end
def receive_pack_allowed? def receive_pack_allowed?
return false unless Gitlab.config.gitlab_shell.receive_pack return false unless Gitlab.config.gitlab_shell.receive_pack
......
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