2020-03-26 08:07:48 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Resolvers
|
|
|
|
module Projects
|
|
|
|
class JiraImportsResolver < BaseResolver
|
|
|
|
include Gitlab::Graphql::Authorize::AuthorizeResource
|
|
|
|
|
|
|
|
alias_method :project, :object
|
|
|
|
|
|
|
|
def resolve(**args)
|
|
|
|
return JiraImportData.none unless project&.import_data.present?
|
|
|
|
|
|
|
|
authorize!(project)
|
|
|
|
|
|
|
|
project.import_data.becomes(JiraImportData).projects
|
|
|
|
end
|
|
|
|
|
|
|
|
def authorized_resource?(project)
|
2020-04-06 11:10:04 -04:00
|
|
|
return false unless Feature.enabled?(:jira_issue_import, project)
|
|
|
|
|
2020-03-26 08:07:48 -04:00
|
|
|
Ability.allowed?(context[:current_user], :admin_project, project)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|