Skip to content
Snippets Groups Projects
Commit c98f89ea authored by Patricio Cano's avatar Patricio Cano
Browse files

Simplify access checks

parent 8b14d1d2
No related branches found
No related tags found
1 merge request!4696Add setting that allows admins to choose which Git access protocols are enabled.
Loading
@@ -162,12 +162,18 @@ class Projects::GitHttpController < Projects::ApplicationController
Loading
@@ -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
   
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment