diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-08-08 12:22:09 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-08-08 12:22:09 +0300 |
commit | 4537623d12fb7372262267be5d6ec3b41f3f476c (patch) | |
tree | ccd0494b1112c388114e032f994505a2344123be /lib/api | |
parent | c7e490ebd5ab69fe043cd39145bd6ef3850a6921 (diff) | |
parent | 1a83fea711961844adc7ddb21ce007143fefc144 (diff) | |
download | gitlab-ce-4537623d12fb7372262267be5d6ec3b41f3f476c.tar.gz |
Merge branch 'master' into karlhungus-mr-on-fork
Conflicts:
app/contexts/filter_context.rb
app/contexts/search_context.rb
app/models/merge_request.rb
app/models/note.rb
app/views/shared/_merge_requests.html.haml
spec/controllers/commit_controller_spec.rb
spec/services/notification_service_spec.rb
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/internal.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/api/internal.rb b/lib/api/internal.rb index a602dc05418..79f8eb3a543 100644 --- a/lib/api/internal.rb +++ b/lib/api/internal.rb @@ -1,6 +1,10 @@ module API # Internal access API class Internal < Grape::API + + DOWNLOAD_COMMANDS = %w{ git-upload-pack git-upload-archive } + PUSH_COMMANDS = %w{ git-receive-pack } + namespace 'internal' do # # Check if ssh key has access to project code @@ -26,16 +30,16 @@ module API if key.is_a? DeployKey - key.projects.include?(project) && git_cmd == 'git-upload-pack' + key.projects.include?(project) && DOWNLOAD_COMMANDS.include?(git_cmd) else user = key.user return false if user.blocked? action = case git_cmd - when 'git-upload-pack', 'git-upload-archive' + when *DOWNLOAD_COMMANDS then :download_code - when 'git-receive-pack' + when *PUSH_COMMANDS then if project.protected_branch?(params[:ref]) :push_code_to_protected_branches |