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

Controllers filters added to BaseController instead of ResourceController #1683

Merged
merged 4 commits into from
Sep 25, 2012

Conversation

yorch
Copy link
Contributor

@yorch yorch commented Sep 18, 2012

In my application, I'm using the before_filter to check if the user is an admin or not (same model for the all the users, but only admin can access the backend/activeadmin). The problem I had was that even non-admin users could access to the dashboard (only the dashboard, not the rest of the admin site) and that's because the before_filter was not applying to it.

So now, the before filter configured on the ActiveAdmin configuration is applied to the BaseController instead of only ResourceController.

@jpmckinney
Copy link
Contributor

You need to update some tests so that they pass before we can merge this. See the Travis build failures.

@yorch
Copy link
Contributor Author

yorch commented Sep 25, 2012

Sorry about that.. Done.
Thanks.

jpmckinney pushed a commit that referenced this pull request Sep 25, 2012
Controllers filters added to BaseController instead of ResourceController
@jpmckinney jpmckinney merged commit e42acc0 into activeadmin:master Sep 25, 2012
@jpmckinney
Copy link
Contributor

Awesome. Merged!

@pcreux
Copy link
Contributor

pcreux commented Sep 25, 2012

👍

@ddonahue99
Copy link

Just ran across this as well, same exact problem with checking if the user is an admin. Thanks for the fix. Should probably release this soon, big security hole here!

@jpmckinney
Copy link
Contributor

You can use HEAD with:

gem 'active_admin', :git => 'https://github.com/gregbell/active_admin.git'

@ddonahue99
Copy link

Already done. :) Just looking out for other people who aren't aware of the issue - glad I had a test for it.

@fabianoalmeida
Copy link

Is this PR up to date in 0.5.0 version?

@jpmckinney
Copy link
Contributor

No, it came after 0.5.0.

@fabianoalmeida
Copy link

@jpmckinney could you help me? I have this route configuration and I'm not getting access "/admin" path. Always redirect to root_path with a log message:

Started GET "/admin" for 127.0.0.1 at 2012-10-04 15:41:36 -0300
Processing by Admin::DashboardController#index as HTML
Completed 401 Unauthorized in 1ms

And I don't know why. This patch solves my "issue" or I'm making some mess? Thanks in advance!

@jpmckinney
Copy link
Contributor

I'm not sure. Can you create a new issue? Maybe the ActionDispatch::Routing::Translator line is interfering?

@fabianoalmeida
Copy link

Thanks @jpmckinney! I created a new issue #1711.

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

Successfully merging this pull request may close these issues.

5 participants