Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cancan - "can :manage, all". I haven't been able to get access to all in rails 3 app with devise

I am using "check authorization" in the application controller so every action will require a permission. I'm starting with giving me, the superadmin :=], permissions to manage all. I thought manage all would give me access to the whole app without naming a resource.

user model:

  def role?(role)
    roles.include? role.to_s
  end

application controller:

check_authorization

cancan's ability model:

  def initialize(user)
    if user.role? :superadmin
      can :manage, :all
    end
  end

error message:

This action failed the check_authorization because it does not authorize_resource. Add skip_authorization_check to bypass this check.

Thank you.

like image 278
Jay Avatar asked Oct 10 '22 07:10

Jay


1 Answers

As far as I am aware, you're going to need to call authorize_resource in your controller as a before filter so that this works.

like image 195
Ryan Bigg Avatar answered Oct 12 '22 23:10

Ryan Bigg