Sha256: 99a0ca29b3fe3c5ff29cf3a95f42c0ae82136da11ec29faf6e56237852991d79

Contents?: true

Size: 594 Bytes

Versions: 1

Compression:

Stored size: 594 Bytes

Contents

module Rails
  module Auth
    class ACL
      # Built-in predicate matchers
      module Matchers
        # Allows unauthenticated clients to access to a given resource
        class AllowAll
          def initialize(enabled)
            fail ArgumentError, "enabled must be true/false" unless [true, false].include?(enabled)
            @enabled = enabled
          end

          def match(_env)
            @enabled
          end
        end

        # Make `allow_all` available by default as an ACL matcher
        ACL::DEFAULT_MATCHERS[:allow_all] = AllowAll
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails-auth-0.1.0 lib/rails/auth/acl/matchers/allow_all.rb