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-2.2.1 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-2.2.0 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-2.1.9 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-2.1.8 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-2.1.7 lib/abilities/thecore_auth_commons.rb
thecore_auth_commons-2.1.5 lib/abilities/thecore_auth_commons.rb