Sha256: 3b51dfc187537e0a08b189f3fe6739b938c82680d8c73432ba2511f776c0b55e

Contents?: true

Size: 628 Bytes

Versions: 26

Compression:

Stored size: 628 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
                    cannot :destroy, User do |u|
                        # prevents killing himself
                        u.id == user.id
                    end
                end
            end
        end
    end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
thecore_auth_commons-3.0.4 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-3.0.3 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-3.0.0 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-2.4.0 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-2.3.9 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-2.3.8 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-2.3.7 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-2.3.6 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-2.3.5 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-2.3.4 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-2.3.3 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-2.3.2 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-2.3.1 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-2.3.0 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-0 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-2.2.9 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-2.2.8 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-2.2.6 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-2.2.5 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-2.2.2 lib/abilities/thecore_auth_commons.rb