Skip to content

Commit 855d854

Browse files
move allow_authorized logic into config, and remove unauthorized on MiniProfiler
1 parent c40b353 commit 855d854

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

lib/mini_profiler.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def call(env)
285285
return client_settings.handle_cookie(@app.call(env))
286286
end
287287

288-
if @config.pre_authorized?(env) || unauthorized?(client_settings)
288+
if @config.pre_authorized?(env) || (config.allow_authorized? && !client_settings.has_valid_cookie?)
289289
if take_snapshot?(path)
290290
return client_settings.handle_cookie(take_snapshot(env, start))
291291
else
@@ -763,9 +763,5 @@ def take_snapshot(env, start)
763763
def public_base_path(env)
764764
"#{env['RACK_MINI_PROFILER_ORIGINAL_SCRIPT_NAME']}#{@config.base_url_path}"
765765
end
766-
767-
def unauthorized?(client_settings)
768-
@config.authorization_mode == :allow_authorized && !client_settings.has_valid_cookie?
769-
end
770766
end
771767
end

lib/mini_profiler/config.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ def merge!(config)
144144
def pre_authorized?(env)
145145
@pre_authorize_cb && !@pre_authorize_cb.call(env)
146146
end
147+
148+
def allow_authorized?
149+
@authorization_mode == :allow_authorized
150+
end
147151
end
148152
end
149153
end

0 commit comments

Comments
 (0)