Sha256: f88cf1f4bf100f8f3e902af2850a1fe37b0c9fd5c12dea1516994da0f2c7e7e4

Contents?: true

Size: 630 Bytes

Versions: 8

Compression:

Stored size: 630 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

8 entries across 8 versions & 1 rubygems

Version Path
thecore-1.7.2 lib/abilities.rb
thecore-1.7.1 lib/abilities.rb
thecore-1.7.0 lib/abilities.rb
thecore-1.6.13 lib/abilities.rb
thecore-1.6.10 lib/abilities.rb
thecore-1.6.9 lib/abilities.rb
thecore-1.6.8 lib/abilities.rb
thecore-1.6.7 lib/abilities.rb