Commit 6cf5d7c96d8fcbf7b1c05481710afc79c2f7aa21
1 parent
7f636b13
Exists in
master
and in
4 other branches
Support read-only access for git over HTTP
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
lib/gitlab/backend/grack_auth.rb
| @@ -38,12 +38,12 @@ module Grack | @@ -38,12 +38,12 @@ module Grack | ||
| 38 | end | 38 | end |
| 39 | 39 | ||
| 40 | def validate_get_request | 40 | def validate_get_request |
| 41 | - true | 41 | + can?(user, :download_code, project) |
| 42 | end | 42 | end |
| 43 | 43 | ||
| 44 | def validate_post_request | 44 | def validate_post_request |
| 45 | if @request.path_info.end_with?('git-upload-pack') | 45 | if @request.path_info.end_with?('git-upload-pack') |
| 46 | - can?(user, :push_code, project) | 46 | + can?(user, :download_code, project) |
| 47 | elsif @request.path_info.end_with?('git-receive-pack') | 47 | elsif @request.path_info.end_with?('git-receive-pack') |
| 48 | action = if project.protected_branch?(current_ref) | 48 | action = if project.protected_branch?(current_ref) |
| 49 | :push_code_to_protected_branches | 49 | :push_code_to_protected_branches |