summaryrefslogtreecommitdiff
path: root/app/finders/sentry_issue_finder.rb
blob: 8b3e710521127cf602f597888e68f224774cd71d (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

class SentryIssueFinder
  attr_accessor :project, :current_user

  def initialize(project, current_user: nil)
    @project = project
    @current_user = current_user
  end

  def execute(identifier)
    return unless authorized?

    SentryIssue
      .for_project_and_identifier(project, identifier)
  end

  private

  def authorized?
    Ability.allowed?(current_user, :read_sentry_issue, project)
  end
end