summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsh McKenzie <amckenzie@gitlab.com>2018-07-25 15:00:07 +1000
committerAsh McKenzie <amckenzie@gitlab.com>2018-07-25 15:00:07 +1000
commitdfe90c578d43405f98eed135367ee454579bfafa (patch)
tree9de3ed4d59446a683997dabf3cf0e5bab302bcf0
parent81478dd72349f95ebe8deaa4b5cae769f8d6c58c (diff)
downloadgitlab-shell-dfe90c578d43405f98eed135367ee454579bfafa.tar.gz
GitlabNet actor is always key_id
-rw-r--r--lib/gitlab_net.rb9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb
index f0987dd..caeaada 100644
--- a/lib/gitlab_net.rb
+++ b/lib/gitlab_net.rb
@@ -11,24 +11,19 @@ class GitlabNet # rubocop:disable Metrics/ClassLength
CHECK_TIMEOUT = 5
GL_PROTOCOL = 'ssh'.freeze
- def check_access(cmd, gl_repository, repo, actor, changes, protocol = GL_PROTOCOL, env: {})
+ def check_access(cmd, gl_repository, repo, key_id, changes, protocol = GL_PROTOCOL, env: {})
changes = changes.join("\n") unless changes.is_a?(String)
params = {
action: cmd,
changes: changes,
gl_repository: gl_repository,
+ key_id: key_id.gsub('key-', ''),
project: sanitize_path(repo),
protocol: protocol,
env: env
}
- if actor =~ /\Akey\-\d+\Z/
- params[:key_id] = actor.gsub("key-", "")
- elsif actor =~ /\Auser\-\d+\Z/
- params[:user_id] = actor.gsub("user-", "")
- end
-
resp = post("#{internal_api_endpoint}/allowed", params)
if resp.code == '200'