Sha256: edbf2dd7f2a01ce42e89fb31eea9044e7b0be27f040e20b62641036e7ed54bf9

Contents?: true

Size: 629 Bytes

Versions: 35

Compression:

Stored size: 629 Bytes

Contents

module TheCoreAbilities
  def core_abilities user
    # So the static link navigation can be set runtime (yes it's an hack)
    RailsAdmin.config do |config|
      config.navigation_static_label = I18n.t("admin.links.label")
    end
    # Normal core abilities file
    if user
      can :access, :rails_admin # grant access to rails_admin
      can :dashboard, :all # allow access to dashboard
      if user.admin?
        can :manage, :all # only allow admin users to access Rails Admin
        cannot :destroy, User do |u|
          # prevents killing himself
          u.id == user.id
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
thecore-1.6.5 lib/abilities.rb
thecore-1.6.4 lib/abilities.rb
thecore-1.6.3 lib/abilities.rb
thecore-1.6.2 lib/abilities.rb
thecore-1.6.1 lib/abilities.rb
thecore-1.6.0 lib/abilities.rb
thecore-1.5.14 lib/abilities.rb
thecore-1.5.13 lib/abilities.rb
thecore-1.5.12 lib/abilities.rb
thecore-1.5.10 lib/abilities.rb
thecore-1.5.9 lib/abilities.rb
thecore-1.5.8 lib/abilities.rb
thecore-1.5.7 lib/abilities.rb
thecore-1.5.6 lib/abilities.rb
thecore-1.5.5 lib/abilities.rb
thecore-1.5.4 lib/abilities.rb
thecore-1.5.3 lib/abilities.rb
thecore-1.5.2 lib/abilities.rb
thecore-1.5.1 lib/abilities.rb
thecore-1.5.0 lib/abilities.rb