Commit e9bef9c00755b09b98fb0961575a12bcaf031bfa
Exists in
master
and in
4 other branches
Merge pull request #2258 from jasl8r/issue-2193-grack-read-only-access
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 |