When using the CanCan adapter in ActiveAdmin 0.6.0. I have a resource working and authorization is working. However, when I go to /admin
, the root ActiveAdmin page, it redirects to /admin
and continues this forever.
相关问题
- mongoid polymorphic association error
- How do I show an error for unauthorized can can ac
- ActiveAdmin: Filter by count of child objects
- NoMethodError: Undefined method 'type' for
- Rails can't find the module, if config.cache_c
相关文章
- Rspec controller error expecting <“index”> but
- Allow users to edit/destroy their own profiles onl
- Is it possible to order multiple columns by using
- Devise/CanCanCan - Allow Admin To Create New Users
- Hstore and Rails
- Rails : How does “new” action called “create” acti
- mocking CanCan authorization while testing control
- Rails 3 ActiveAdmin. How to set a default sort ord
You can use
config.on_unauthorized_access
config option as described here.I had the same error, and I have an admin user with:
I just forgot to add the correct role to this user, so maybe someone will have the same infinite redirect loop as me with ActiveAdmin and Cancan.
If the user does not have access to a page, ActiveAdmin redirects to the Dashboard. If the user doesn't have access to the dashboard, this results in an infinite redirect.
Solution is to give the user the ability to read the dashboard page. Place this in the ability model object:
This is mentioned in the authorization adapter documentation, but the infinite redirect seems to be caused by a bug in ActiveAdmin. It is neither raising a CanCan::AccessDenied, nor displaying an message to the user. At the least, it should display a message in development to help troubleshoot this issue. But it does not currently.