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/application_context.rb')
-rw-r--r--lib/gitlab/application_context.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/gitlab/application_context.rb b/lib/gitlab/application_context.rb
index 1920e1443da..b6ad25e700b 100644
--- a/lib/gitlab/application_context.rb
+++ b/lib/gitlab/application_context.rb
@@ -11,6 +11,7 @@ module Gitlab
LOG_KEY = Labkit::Context::LOG_KEY
KNOWN_KEYS = [
:user,
+ :user_id,
:project,
:root_namespace,
:client_id,
@@ -98,6 +99,7 @@ module Gitlab
assign_hash_if_value(hash, :artifacts_dependencies_count)
hash[:user] = -> { username } if include_user?
+ hash[:user_id] = -> { user_id } if include_user?
hash[:project] = -> { project_path } if include_project?
hash[:root_namespace] = -> { root_namespace_path } if include_namespace?
hash[:client_id] = -> { client } if include_client?
@@ -147,6 +149,11 @@ module Gitlab
associated_user&.username
end
+ def user_id
+ associated_user = user || job_user
+ associated_user&.id
+ end
+
def root_namespace_path
associated_routable = namespace || project || runner_project || runner_group || job_project
associated_routable&.full_path_components&.first