Sha256: 2d623d40737c059917d3351bbb44e59b9f815648a718a4e87e7d69ae9a9d4eac
Contents?: true
Size: 896 Bytes
Versions: 11
Compression:
Stored size: 896 Bytes
Contents
# frozen_string_literal: true module RailsMiniProfiler class User class << self def current_user Thread.current[:rails_mini_profiler_current_user] end def get(env) new(Thread.current[:rails_mini_profiler_current_user], env).current_user end def authorize(user) Thread.current[:rails_mini_profiler_current_user] = user end def current_user=(user) Thread.current[:rails_mini_profiler_current_user] = user end end def initialize(current_user, env) @current_user = current_user @env = env end def current_user @current_user ||= find_current_user end def find_current_user return unless Rails.env.development? || Rails.env.test? user = RailsMiniProfiler.configuration.user_provider.call(@env) User.current_user = user user end end end
Version data entries
11 entries across 11 versions & 1 rubygems