Sha256: 9a7d287a120c35bad15551487f5577739d900a90056ba449391d6a6752c3bdb0

Contents?: true

Size: 941 Bytes

Versions: 23

Compression:

Stored size: 941 Bytes

Contents

module Authority
  class Configuration

    # Has default settings, which can be overridden in the initializer.

    attr_accessor :abilities, :controller_action_map, :user_method, :security_violation_handler, :logger

    def initialize

      @abilities = {
        :create => 'creatable',
        :read   => 'readable',
        :update => 'updatable',
        :delete => 'deletable'
      }

      @controller_action_map = {
        :index   => 'read',
        :show    => 'read',
        :new     => 'create',
        :create  => 'create',
        :edit    => 'update',
        :update  => 'update',
        :destroy => 'delete'
      }

      @user_method = :current_user

      @security_violation_handler = :authority_forbidden

      @logger = Logger.new(STDERR)
    end

    def default_strategy=(val)
      raise ArgumentError, "`config.default_strategy=` was removed in Authority 2.0; see README and CHANGELOG"
    end

  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
authority-2.2.0 lib/authority/configuration.rb
authority-2.1.0 lib/authority/configuration.rb
authority-2.0.1 lib/authority/configuration.rb