diff options
author | Michael Kozono <mkozono@gmail.com> | 2017-05-22 12:44:59 -0700 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2017-06-05 05:32:26 -0700 |
commit | 0a0f66c816469e197237a6eeaedeb959b5d1c823 (patch) | |
tree | 62481447ef7e5b27279d0c767932f5dd2df29c90 /lib/gitlab/git_access.rb | |
parent | 7d469cf1c1f356d950abc58ecbe6aa4ec15bd72b (diff) | |
download | gitlab-ce-0a0f66c816469e197237a6eeaedeb959b5d1c823.tar.gz |
Refactor to remove a special case
Diffstat (limited to 'lib/gitlab/git_access.rb')
-rw-r--r-- | lib/gitlab/git_access.rb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb index 75cc69c02f7..f44426d62b8 100644 --- a/lib/gitlab/git_access.rb +++ b/lib/gitlab/git_access.rb @@ -29,7 +29,11 @@ module Gitlab @project = project @protocol = protocol @authentication_abilities = authentication_abilities - @user_access = UserAccess.new(user, project: project) + @user_access = if ci? + CiAccess.new + else + UserAccess.new(user, project: project) + end end def check(cmd, changes) @@ -62,11 +66,6 @@ module Gitlab authentication_abilities.include?(:build_download_code) && user_access.can_do_action?(:build_download_code) end - # Allow generic CI (build without a user) for backwards compatibility - def ci_can_download_code? - authentication_abilities.include?(:build_download_code) && ci? - end - def protocol_allowed? Gitlab::ProtocolAccess.allowed?(protocol) end @@ -129,7 +128,6 @@ module Gitlab return if deploy_key? passed = user_can_download_code? || - ci_can_download_code? || build_can_download_code? || guest_can_download_code? |