cartodb-4.42/app/controllers/data_library_controller.rb

24 lines
789 B
Ruby
Raw Normal View History

2024-04-06 13:25:13 +08:00
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.get_config(:data_library, 'username') != @viewed_user.username))
@dataset_base_url = Cartodb.get_config(:ssl_required) == true ? "#{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