Add Sentry program context even without a current user
This commit is contained in:
parent
95a867e0af
commit
f583129767
|
@ -14,7 +14,7 @@ class ApplicationController < ActionController::Base
|
||||||
before_action :check_password_expiration
|
before_action :check_password_expiration
|
||||||
before_action :check_2fa_requirement
|
before_action :check_2fa_requirement
|
||||||
before_action :ldap_security_check
|
before_action :ldap_security_check
|
||||||
before_action :sentry_user_context
|
before_action :sentry_context
|
||||||
before_action :default_headers
|
before_action :default_headers
|
||||||
before_action :add_gon_variables
|
before_action :add_gon_variables
|
||||||
before_action :configure_permitted_parameters, if: :devise_controller?
|
before_action :configure_permitted_parameters, if: :devise_controller?
|
||||||
|
@ -41,13 +41,15 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def sentry_user_context
|
def sentry_context
|
||||||
if Rails.env.production? && current_application_settings.sentry_enabled && current_user
|
if Rails.env.production? && current_application_settings.sentry_enabled
|
||||||
Raven.user_context(
|
if current_user
|
||||||
id: current_user.id,
|
Raven.user_context(
|
||||||
email: current_user.email,
|
id: current_user.id,
|
||||||
username: current_user.username,
|
email: current_user.email,
|
||||||
)
|
username: current_user.username,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
Raven.tags_context(program: sentry_program_context)
|
Raven.tags_context(program: sentry_program_context)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue