Sha256: ef85109f2fe48bf7c82a9848e3d4aa9dbdee51032678bc932a8a4a43a1a66c0b

Contents?: true

Size: 646 Bytes

Versions: 1

Compression:

Stored size: 646 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

        access_rights_regex = Lockdown.regex(access_rights)

        path += "/" unless path =~ /\/$/
        path = "/" + path unless path =~ /^\//
        
        if access_rights_regex =~ path 
          return true 
        end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lockdown-2.0.2 lib/lockdown/delivery.rb