sferik/rails_admin — Issue #809: Can't access Dashboard or History with cancan permissions
Author: damiena
Created: 2011-10-31 16:57:45+00:00
State: open

I'm using cancan to restrict access (read and update) to certain records.

User has a role which corresponds to a provider field in the other models. List, show and edit pages are filtered perfectly based on this role. However only Admin user is able to access the dashboard and histories. I have tried adding "can :history" to all users to no avail. (I also tried :see_history).

class Ability
include CanCan::Ability

def initialize(user)
if user
can :access, :rails_admin
#can :read, :all
#can :index, [Person, Parent, Eoi]
can :history
end

if user.role == 'admin'
can :manage, :all
end

if user.role == 'Durham'
can :manage, Person, :provider => 'Durham'
can :manage, Parent, :provider => 'Durham'
end