Sha256: 231f4734ff89e46da1c89d47d0151b87a930aae7f4ded258d0203bbedbe086e1

Contents?: true

Size: 757 Bytes

Versions: 14

Compression:

Stored size: 757 Bytes

Contents

# Application's CanCan ability class. Engines will include their ability classes
#------------------------------------------------------------------------------
class Ability
  include CanCan::Ability
  include DmCore::Concerns::Ability
  
  @@registered_abilities = []  

  #------------------------------------------------------------------------------
  def initialize(user)
    @user_roles = user.roles.all if user
    @@registered_abilities.each {|method| self.send method, user}
    
    dm_core_abilities(user)
  end
  
  # allows an engine to register it's ability method
  #------------------------------------------------------------------------------
  def self.register_abilities(method_name)
    @@registered_abilities << method_name
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
dm_core-4.2.3.10 app/models/ability.rb
dm_core-4.2.3.9 app/models/ability.rb
dm_core-4.2.3.8 app/models/ability.rb
dm_core-4.2.3.7 app/models/ability.rb
dm_core-4.2.3.6 app/models/ability.rb
dm_core-4.2.3.5 app/models/ability.rb
dm_core-4.2.3.4 app/models/ability.rb
dm_core-4.2.3.3 app/models/ability.rb
dm_core-4.2.3.2 app/models/ability.rb
dm_core-4.2.3.1 app/models/ability.rb
dm_core-4.2.3 app/models/ability.rb
dm_core-4.2.2.3 app/models/ability.rb
dm_core-4.2.2.2 app/models/ability.rb
dm_core-4.2.2.1 app/models/ability.rb