Sha256: 5fbcd1423b10870f4c3874c9893bb0997bca1f572037742aba785f4a3c18e4bf
Contents?: true
Size: 528 Bytes
Versions: 2
Compression:
Stored size: 528 Bytes
Contents
# frozen_string_literal: true module EacRailsBase0 class Ability include CanCan::Ability def initialize(user) user ||= ::EacUsersSupport::User.new devise_rules(user) administrator_rules(user) end def devise_rules(user) if user.new_record? can :create, 'Devise::Session' else can :destroy, 'Devise::Session' end end def administrator_rules(user) return unless user.administrator? can :manage, ::EacUsersSupport::User end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
eac_rails_base0-0.2.0 | lib/eac_rails_base0/ability.rb |
eac_rails_base0-0.1.0 | lib/eac_rails_base0/ability.rb |