diff options
author | Nick Thomas <nick@gitlab.com> | 2018-11-08 00:26:14 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-11-08 00:26:14 +0000 |
commit | a44b30f7f96ab39f98cf12a57f973ff51941141c (patch) | |
tree | a83d262d697d3d5265716ddd8bf7650870063eca /lib/gitlab_net.rb | |
parent | 9cf3334cb5cdf871266a2b9538589e36efd788e1 (diff) | |
parent | 1c6a8d1d70c1603c73fb9bcb8f440dbf97988e89 (diff) | |
download | gitlab-shell-a44b30f7f96ab39f98cf12a57f973ff51941141c.tar.gz |
Merge branch 'ashmckenzie/8114-geo-push-ssh-lfs-http-auth-bug' into 'master'
Include LFS operation when requesting auth
See merge request gitlab-org/gitlab-shell!254
Diffstat (limited to 'lib/gitlab_net.rb')
-rw-r--r-- | lib/gitlab_net.rb | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb index ac98e9f..bba68f3 100644 --- a/lib/gitlab_net.rb +++ b/lib/gitlab_net.rb @@ -53,28 +53,22 @@ class GitlabNet # rubocop:disable Metrics/ClassLength JSON.parse(resp.body) rescue nil end - def lfs_authenticate(gl_id, repo) + def lfs_authenticate(gl_id, repo, operation) id_sym, _, id = self.class.parse_who(gl_id) + params = { project: sanitize_path(repo), operation: operation } - if id_sym == :key_id - params = { - project: sanitize_path(repo), - key_id: id - } - elsif id_sym == :user_id - params = { - project: sanitize_path(repo), - user_id: id - } + case id_sym + when :key_id + params[:key_id] = id + when :user_id + params[:user_id] = id else raise ArgumentError, "lfs_authenticate() got unsupported GL_ID='#{gl_id}'!" end resp = post("#{internal_api_endpoint}/lfs_authenticate", params) - if resp.code == '200' - GitlabLfsAuthentication.build_from_json(resp.body) - end + GitlabLfsAuthentication.build_from_json(resp.body) if resp.code == '200' end def broadcast_message |