Sha256: c26b4c439440682a41b06388df7b701ea85affe5c5188d7f6ad27b55c26bfa2e

Contents?: true

Size: 582 Bytes

Versions: 1

Compression:

Stored size: 582 Bytes

Contents

module Rails
  module Auth
    class ACL
      # Built-in predicate matchers
      module Matchers
        # Allows all principals 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.0.1 lib/rails/auth/acl/matchers/allow_all.rb