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

jira_imports_resolver.rb « projects « resolvers « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 25361c068d95452791e17f775c244b0198d6e293 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

module Resolvers
  module Projects
    class JiraImportsResolver < BaseResolver
      include Gitlab::Graphql::Authorize::AuthorizeResource

      alias_method :project, :object

      def resolve(**args)
        authorize!(project)

        project.jira_imports
      end

      def authorized_resource?(project)
        return false unless project.jira_issues_import_feature_flag_enabled?

        context[:current_user].present? && Ability.allowed?(context[:current_user], :read_project, project)
      end
    end
  end
end