summaryrefslogtreecommitdiff
path: root/app/finders/sentry_issue_finder.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/finders/sentry_issue_finder.rb')
-rw-r--r--app/finders/sentry_issue_finder.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/finders/sentry_issue_finder.rb b/app/finders/sentry_issue_finder.rb
new file mode 100644
index 00000000000..8b3e7105211
--- /dev/null
+++ b/app/finders/sentry_issue_finder.rb
@@ -0,0 +1,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