diff options
author | Stan Hu <stanhu@gmail.com> | 2017-11-08 19:21:39 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-11-08 19:21:39 +0300 |
commit | 0232450c8aee08a656275caf7b990e0bcbbb1cf4 (patch) | |
tree | 9817869e4ed30b9ab05480c8b3daa6776148e557 /lib/gitlab/auth.rb | |
parent | 9e294180f29ec7ec9e9734a65b2b5d3124d657e4 (diff) |
Fix Error 500 when pushing LFS objects with a write deploy key
Diffstat (limited to 'lib/gitlab/auth.rb')
-rw-r--r-- | lib/gitlab/auth.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb index 0ad9285c0ea..cbbc51db99e 100644 --- a/lib/gitlab/auth.rb +++ b/lib/gitlab/auth.rb @@ -25,7 +25,7 @@ module Gitlab result = service_request_check(login, password, project) || build_access_token_check(login, password) || - lfs_token_check(login, password) || + lfs_token_check(login, password, project) || oauth_access_token_check(login, password) || personal_access_token_check(password) || user_with_password_for_git(login, password) || @@ -146,7 +146,7 @@ module Gitlab end.flatten.uniq end - def lfs_token_check(login, password) + def lfs_token_check(login, password, project) deploy_key_matches = login.match(/\Alfs\+deploy-key-(\d+)\z/) actor = @@ -163,6 +163,8 @@ module Gitlab authentication_abilities = if token_handler.user? full_authentication_abilities + elsif token_handler.deploy_key_pushable?(project) + read_write_authentication_abilities else read_authentication_abilities end @@ -208,10 +210,15 @@ module Gitlab ] end - def full_authentication_abilities + def read_write_authentication_abilities read_authentication_abilities + [ :push_code, - :create_container_image, + :create_container_image + ] + end + + def full_authentication_abilities + read_write_authentication_abilities + [ :admin_container_image ] end |