blob: 1c21d28618781a36b48c4fb47d295cff018eb842 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# frozen_string_literal: true
module Gitlab
module Graphql
module Project
class DastProfileConnectionExtension < GraphQL::Schema::FieldExtension
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
project_users = dast_profiles.group_by(&:project).transform_values do |project_profiles|
project_profiles
.filter_map { |profile| profile.dast_profile_schedule&.owner }
.uniq
end
Preloaders::UsersMaxAccessLevelByProjectPreloader.new(project_users: project_users).execute
end
end
end
end
end
|