skip domain filter for api shops index
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
class Api::ShopsController < Api::ApiController
|
||||
skip_before_action :authenticate, only: [:index, :show]
|
||||
skip_before_action :set_current_tenant_by_subdomain_or_name, only: [:index, :show]
|
||||
skip_before_action :authenticate, only: [:index]
|
||||
skip_before_action :set_current_tenant_by_subdomain_or_name, only: [:index]
|
||||
|
||||
def index
|
||||
@shops = Shop.select('id, logo, name, shop_code').all
|
||||
@shops = Shop.select('id, logo, name, shop_code').where.not(cloud_url: nil).all
|
||||
end
|
||||
|
||||
def show
|
||||
@@ -13,4 +13,23 @@ class Api::ShopsController < Api::ApiController
|
||||
def get_tax_profiles
|
||||
@inclusive_tax, @exclusive_tax = TaxProfile.calculate_tax("online_order")
|
||||
end
|
||||
|
||||
def lookup_domain
|
||||
unless action_name == "index"
|
||||
if ENV["SERVER_CODE"] == "cloud" && request.subdomains.last && request.subdomains.last != "www"
|
||||
@license = cache_license(ENV["SX_PROVISION_URL"], request.host) # request.subdomain.downcase
|
||||
if (!@license.nil?)
|
||||
logger.info "Location - " + @license.dbschema
|
||||
ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||
else
|
||||
logger.info 'License is nil'
|
||||
not_found
|
||||
end
|
||||
elsif ENV["SERVER_MODE"] == "application" || (request.subdomains.last && request.subdomains.last != "www")
|
||||
not_found unless check_license(request.host)
|
||||
end
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -132,9 +132,7 @@ class ActionController::API
|
||||
# render :json => [{ status: false, message: 'Invalid Access!'}]
|
||||
end
|
||||
elsif ENV["SERVER_MODE"] == "application" || (request.subdomains.last && request.subdomains.last != "www")
|
||||
unless check_license(request.host)
|
||||
not_found
|
||||
end
|
||||
not_found unless check_license(request.host)
|
||||
else
|
||||
not_found
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user