Sha256: a0159ed194aa2f07a75952d26f23278f23357edcc2ad9bc3fe98059659c272e2

Contents?: true

Size: 727 Bytes

Versions: 9

Compression:

Stored size: 727 Bytes

Contents

module CanTango
  class PermissionEngine < Engine
    autoload_modules :Collector, :Compiler, :Evaluator, :Selector
    autoload_modules :Factory, :Loader, :Parser, :Permission
    autoload_modules :RulesParser, :Store, :YamlStore, :Statements, :Statement

    def initialize ability
      super
    end

    def execute!
      puts "Permission Engine executing..." if CanTango.config.debug.on?
      permissions.each do |permission|
        permission.evaluate! user
      end
    end

    def permissions
      permission_factory.build!
    end

    protected

    def user
      ability.user
    end

    def permission_factory
      @permission_factory ||= CanTango::PermissionEngine::Factory.new ability
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cantango-0.8.9.5 lib/cantango/permission_engine.rb
cantango-0.8.9.4 lib/cantango/permission_engine.rb
cantango-0.8.9.3 lib/cantango/permission_engine.rb
cantango-0.8.9.2 lib/cantango/permission_engine.rb
cantango-0.8.9.1 lib/cantango/permission_engine.rb
cantango-0.8.9 lib/cantango/permission_engine.rb
cantango-0.8.8.1 lib/cantango/permission_engine.rb
cantango-0.8.8 lib/cantango/permission_engine.rb
cantango-0.8.7 lib/cantango/permission_engine.rb