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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-02-18 12:45:46 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-18 12:45:46 +0300
commita7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch)
tree7452bd5c3545c2fa67a28aa013835fb4fa071baf /lib/gitlab/graphql
parentee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff)
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'lib/gitlab/graphql')
-rw-r--r--lib/gitlab/graphql/project/dast_profile_connection_extension.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/gitlab/graphql/project/dast_profile_connection_extension.rb b/lib/gitlab/graphql/project/dast_profile_connection_extension.rb
new file mode 100644
index 00000000000..a3c3f2f2b7e
--- /dev/null
+++ b/lib/gitlab/graphql/project/dast_profile_connection_extension.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+module Gitlab
+ module Graphql
+ module Project
+ class DastProfileConnectionExtension < GraphQL::Schema::Field::ConnectionExtension
+ def after_resolve(value:, object:, context:, **rest)
+ preload_authorizations(context[:project_dast_profiles])
+ context[:project_dast_profiles] = nil
+ value
+ end
+
+ def preload_authorizations(dast_profiles)
+ return unless dast_profiles
+
+ projects = dast_profiles.map(&:project)
+ users = dast_profiles.filter_map { |dast_profile| dast_profile.dast_profile_schedule&.owner }
+ Preloaders::UsersMaxAccessLevelInProjectsPreloader.new(projects: projects, users: users).execute
+ end
+ end
+ end
+ end
+end