Sha256: 46e71dc966c1c7359977ee6c5bbb7b28a90b5e3a8535b68aa8d428ba1e2325a0

Contents?: true

Size: 661 Bytes

Versions: 2

Compression:

Stored size: 661 Bytes

Contents

# encoding: utf-8

module Lockdown
  class Delivery
    class << self
      # @return [true|false] if the given path is allowed
      def allowed?(path, access_rights = nil)
        begin
          ::Authorization.configure
        rescue NameError
        end

        access_rights ||= Lockdown::Configuration.public_access

        path += "/" unless path =~ /\/$/
        path = "/" + path unless path =~ /^\//

        access_rights.split(Lockdown::DELIMITER).each do |ar|
          if (Lockdown.regex(ar) =~ path) == 0
            return true
          end
        end

        return false
      end
    end # class block
  end # Delivery
end # Lockdown

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lockdown-2.0.7 lib/lockdown/delivery.rb
lockdown-2.0.6 lib/lockdown/delivery.rb