Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deauthorize Rack-mini-profiler for non admin users #145

Open
guysopher opened this issue Apr 8, 2013 · 2 comments
Open

deauthorize Rack-mini-profiler for non admin users #145

guysopher opened this issue Apr 8, 2013 · 2 comments

Comments

@guysopher
Copy link

Hi,
I am trying to install Rack-mini-profiler on my ROR application. I installed the gem and the profiler works great in development but I can't deauthorize specific requests for non admin users. I placed the following code in my ApplicationController before_filter

def authorize_mini_profiler
if current_user.nil?
Rack::MiniProfiler.deauthorize_request
return
elsif is_admin_user
Rack::MiniProfiler.authorize_request
return
end
Rack::MiniProfiler.deauthorize_request
end
In debug I saw that the deauthorize method is called but the profiler is still displayed.

I even tried using this code

def authorize_mini_profiler
Rack::MiniProfiler.deauthorize_request
end
but still, every request by any user displays the profiler.

Does anyone knows what might be the problem?
Thanks

@jonuhal
Copy link

jonuhal commented Apr 11, 2013

I am having this same problem. Basically, the deauthorize_request method does not seem to have the affect I was expecting. The mini_profiler always shows the profile stats regardless of the authorize / deauthorize and regardless of the environment I am running.

@chrisdebruin
Copy link

create a rack_mini_profiler.rb in your initializers dir and add to following line:

Rack::MiniProfiler.config.authorization_mode = :whitelist

The default is :all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants