-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d2f283
commit fccf57a
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# frozen_string_literal: true | ||
|
||
module SentryUserContext | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
before_action :set_sentry_context | ||
end | ||
|
||
private | ||
|
||
def sentry_user_context | ||
{}.tap do |user| | ||
next unless current_user | ||
|
||
user[:id] = current_user.id | ||
user[:email] = current_user.cas_mail | ||
user[:name] = current_user.username | ||
end | ||
end | ||
|
||
def set_sentry_context | ||
Sentry.set_user(sentry_user_context) | ||
end | ||
end |