summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatricio Cano <suprnova32@gmail.com>2016-06-22 13:08:02 -0500
committerPatricio Cano <suprnova32@gmail.com>2016-07-05 16:54:22 -0500
commitc98f89eac7e2ebf6af4f242d94253c1260517f39 (patch)
tree4b85aeb5cbfe4367fa393525ba3a06644519e155
parent8b14d1d2c20a5b8c7ef985007f90fd3aa12c3277 (diff)
downloadgitlab-ce-c98f89eac7e2ebf6af4f242d94253c1260517f39.tar.gz
Simplify access checks
-rw-r--r--app/controllers/projects/git_http_controller.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/controllers/projects/git_http_controller.rb b/app/controllers/projects/git_http_controller.rb
index 79a7e61e3fe..f124333bd5b 100644
--- a/app/controllers/projects/git_http_controller.rb
+++ b/app/controllers/projects/git_http_controller.rb
@@ -162,12 +162,18 @@ class Projects::GitHttpController < Projects::ApplicationController
return false unless Gitlab.config.gitlab_shell.upload_pack
if user
- Gitlab::GitAccess.new(user, project, 'http').download_access_check.allowed?
+ access.allowed?
else
ci? || project.public?
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?
return false unless Gitlab.config.gitlab_shell.receive_pack