cartodb-4.29/app/controllers/data_library_controller.rb
2020-06-15 10:58:47 +08:00

24 lines
789 B
Ruby

class DataLibraryController < ApplicationController
layout 'data_library'
ssl_allowed :index, :search
before_filter :get_viewed_user
def index
render_404 and return if @viewed_user.nil? || (Cartodb.get_config(:data_library, 'username') && (Cartodb.config[:data_library]['username'] != @viewed_user.username))
@dataset_base_url = (Rails.env.production? || Rails.env.staging?) ? "#{request.protocol}#{CartoDB.account_host}/dataset/" : "#{@viewed_user.public_url(nil, request.protocol == "https://" ? "https" : "http")}/tables/"
respond_to do |format|
format.html { render 'index' }
end
end
private
def get_viewed_user
username = CartoDB.extract_subdomain(request).strip.downcase
@viewed_user = User.where(username: username).first
end
end