Sha256: 865e7b0e9c22c075f2df0002fba2937ec31d9494ad3ae359d654ab0eb0883552

Contents?: true

Size: 983 Bytes

Versions: 7

Compression:

Stored size: 983 Bytes

Contents

# ValidTenancyUrls will lookup configuration hash and
# deal with invalid urls. Its used by routing to constrain
# multi tenancy controllers
# SAAS: File related to SAAS with Custom Domains functionality

# TODO: Write Tests (PN)
module IuguSDK
  class ValidTenancyUrls

    # +matches?+ will check a request.host against a set of invalid urls
    #
    # * *Args*:
    #   - +request+ -> An ActionDispatch::Request object
    # * *Success*
    #   - Return true if request.host is found in the invalid array
    # * *False*
    #   - Return true if request.host is not found in the invalid array
    def self.matches?(request)
      application_domain = IuguSDK::application_main_host
      invalids = [ application_domain, ['www.',application_domain].join ]
      invalids |= IuguSDK::custom_domain_invalid_prefixes.map { |prefix| [prefix,application_domain].join }
      invalids |= IuguSDK::custom_domain_invalid_hosts
      !invalids.include?( request.host )
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
iugusdk-1.0.0.alpha.7 lib/iugusdk/valid_tenancy_urls.rb
iugusdk-1.0.0.alpha.5 lib/iugusdk/valid_tenancy_urls.rb
iugusdk-1.0.0.alpha.4 lib/iugusdk/valid_tenancy_urls.rb
iugusdk-1.0.0.alpha.3 lib/iugusdk/valid_tenancy_urls.rb
iugusdk-1.0.0.alpha.2 lib/iugusdk/valid_tenancy_urls.rb
iugusdk-1.0.0.alpha.1 lib/iugusdk/valid_tenancy_urls.rb
iugusdk-1.0.0.alpha.0 lib/iugusdk/valid_tenancy_urls.rb