Sha256: e47cce6f7cefce690478fd718f909465fa82824add54af95f4d4b5709c42e41a

Contents?: true

Size: 1002 Bytes

Versions: 8

Compression:

Stored size: 1002 Bytes

Contents

class Ability
  include CanCan::Ability

  def initialize(user)

    if user.group.name == "Admin"
      can :manage, :all
    else
      # cannot :manage, Adminpanel::User
      # can :manage, Adminpanel::Analytic
      # can :manage, Adminpanel::Section
      # can :manage, Adminpanel::Gallery
      # can :manage, Adminpanel::Category
    end

    # The first argument to `can` is the action you are giving the user
    # permission to do.
    # If you pass :manage it will apply to every action. Other common actions
    # here are :read, :create, :update and :destroy.
    #
    # The second argument is the resource the user can perform the action on.
    # If you pass :all it will apply to every resource. Otherwise pass a Ruby
    # class of the resource.
    #
    # The third argument is an optional hash of conditions to further filter the
    # objects.
    # For example, here the user can only update published articles.
    #
    #   can :update, Article, :published => true
  end
end

Version data entries

8 entries across 5 versions & 1 rubygems

Version Path
adminpanel-2.0.1 lib/generators/adminpanel/initialize/templates/ability.rb
adminpanel-2.0.0 lib/generators/adminpanel/initialize/templates/ability.rb
adminpanel-1.2.12 lib/generators/adminpanel/initialize/templates/ability.rb
adminpanel-1.2.12 spec/dummy/app/models/ability.rb
adminpanel-1.2.11 lib/generators/adminpanel/initialize/templates/ability.rb
adminpanel-1.2.11 spec/dummy/app/models/ability.rb
adminpanel-1.2.10 lib/generators/adminpanel/initialize/templates/ability.rb
adminpanel-1.2.10 spec/dummy/app/models/ability.rb