Sha256: 2750afd6008542c81df56104e6e9f534dcdf0d989bc182217d3cf3036bf04727

Contents?: true

Size: 627 Bytes

Versions: 18

Compression:

Stored size: 627 Bytes

Contents

module Abilities
    class ThecoreAuthCommons
        include CanCan::Ability
        def initialize user
            # Main abilities file for Thecore applications
            if user.present?
                # Users' abilities
                # -
                if user.admin?
                    # Admins' abiities
                    can :manage, :all # only allow admin users to access Rails Admin
                    # prevents killing himself
                    cannot :destroy, ::User do |u| 
                        u.id == user.id
                    end
                end
            end
        end
    end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
thecore_auth_commons-3.2.2 config/initializers/abilities.rb
thecore_auth_commons-3.2.1 config/initializers/abilities.rb
thecore_auth_commons-3.1.7 config/initializers/abilities.rb
thecore_auth_commons-3.1.5 config/initializers/abilities.rb
thecore_auth_commons-3.1.4 config/initializers/abilities.rb
thecore_auth_commons-3.1.3 config/initializers/abilities.rb
thecore_auth_commons-3.1.2 config/initializers/abilities.rb
thecore_auth_commons-3.1.1 config/initializers/abilities.rb
thecore_auth_commons-3.1.0 config/initializers/abilities.rb
thecore_auth_commons-3.0.13 config/initializers/abilities.rb
thecore_auth_commons-3.0.12 config/initializers/abilities.rb
thecore_auth_commons-3.0.11 config/initializers/abilities.rb
thecore_auth_commons-3.0.10 config/initializers/abilities.rb
thecore_auth_commons-3.0.9 config/initializers/abilities.rb
thecore_auth_commons-3.0.8 config/initializers/abilities.rb
thecore_auth_commons-3.0.7 config/initializers/abilities.rb
thecore_auth_commons-3.0.6 config/initializers/abilities.rb
thecore_auth_commons-3.0.5 config/initializers/abilities.rb