Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/identifier.rb')
-rw-r--r--lib/gitlab/identifier.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/gitlab/identifier.rb b/lib/gitlab/identifier.rb
index 08d44184bb6..720f8748cba 100644
--- a/lib/gitlab/identifier.rb
+++ b/lib/gitlab/identifier.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-# Detect user based on identifier like
+# Detect user or keys based on identifier like
# key-13 or user-36
module Gitlab
module Identifier
@@ -35,6 +35,13 @@ module Gitlab
end
end
+ # Tries to identify a deploy key using a SSH key identifier (e.g. "key-123").
+ def identify_using_deploy_key(identifier)
+ key_id = identifier.gsub("key-", "")
+
+ DeployKey.find_by_id(key_id)
+ end
+
def identify_with_cache(category, key)
if identification_cache[category].key?(key)
identification_cache[category][key]