Sha256: d8267ed5be526c43f032a509fc8ac2da7c2866811b9123d5c75a10acc0d84d6a

Contents?: true

Size: 690 Bytes

Versions: 6

Compression:

Stored size: 690 Bytes

Contents

class Ability
  include CanCan::Ability

  def initialize(user)
    if !user.nil? and (user.admin? or user.manager?)
      can :read, :all
      can :manage, :all
      if user.admin?
        admin_ui(user)
      elsif user.manager?
        manager_ui(user)
      end
    end
  end

  def admin_ui(user)
    can :access, :rails_admin   # grant access to rails_admin
    can :dashboard              # grant access to the dashboard
  end

  def manager_ui(user)
    can :access, :rails_admin   # grant access to rails_admin
    can :dashboard              # grant access to the dashboard
    cannot :manage, Menu
    cannot [:edit, :destroy, :new, :create], User
    can :edit, user
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ack_rocket_cms-0.7.2.4 lib/generators/rocket_cms/templates/ability.erb
ack_rocket_cms-0.7.2.3.2 lib/generators/rocket_cms/templates/ability.erb
ack_rocket_cms-0.7.2.3.1 lib/generators/rocket_cms/templates/ability.erb
ack_rocket_cms-0.7.2.3 lib/generators/rocket_cms/templates/ability.erb
ack_rocket_cms-0.7.2.2 lib/generators/rocket_cms/templates/ability.erb
ack_rocket_cms-0.7.2.1 lib/generators/rocket_cms/templates/ability.erb