This commit is contained in:
zhongjin 2021-01-24 16:18:54 +08:00
parent aeb8917aff
commit cd60625489
54 changed files with 105 additions and 157 deletions

View File

@ -1,3 +1,4 @@
# encoding: utf-8
require_dependency 'carto/uuidhelper' require_dependency 'carto/uuidhelper'
require_relative '../builder/builder_users_module' require_relative '../builder/builder_users_module'

View File

@ -1,3 +1,5 @@
# encoding: utf-8
module Carto module Carto
module Builder module Builder
module BuilderUsersModule module BuilderUsersModule

View File

@ -1,3 +1,5 @@
# encoding: UTF-8
require_dependency 'carto/oauth/github/api' require_dependency 'carto/oauth/github/api'
require_dependency 'carto/oauth/github/config' require_dependency 'carto/oauth/github/config'
require_dependency 'carto/oauth/google/api' require_dependency 'carto/oauth/google/api'

View File

@ -1,3 +1,4 @@
# encoding: UTF-8
require_dependency 'carto/oauth/github/config' require_dependency 'carto/oauth/github/config'
require_dependency 'carto/oauth/google/config' require_dependency 'carto/oauth/google/config'
require_dependency 'carto/saml_service' require_dependency 'carto/saml_service'

View File

@ -1,3 +1,5 @@
# coding: utf-8
require File.expand_path('../boot', __FILE__) require File.expand_path('../boot', __FILE__)
require "action_controller/railtie" require "action_controller/railtie"

View File

@ -1,3 +1,5 @@
# coding: UTF-8
require 'carto/configuration' require 'carto/configuration'
CartoDB::Application.configure do CartoDB::Application.configure do

View File

@ -1,3 +1,5 @@
# coding: UTF-8
require 'carto/configuration' require 'carto/configuration'
CartoDB::Application.configure do CartoDB::Application.configure do

View File

@ -1,3 +1,5 @@
# coding: UTF-8
require 'carto/configuration' require 'carto/configuration'
CartoDB::Application.configure do CartoDB::Application.configure do

View File

@ -1,3 +1,5 @@
# coding: UTF-8
require 'carto/configuration' require 'carto/configuration'
CartoDB::Application.configure do CartoDB::Application.configure do

View File

@ -1,3 +1,5 @@
# coding: UTF-8
CartoDB::Application.configure do CartoDB::Application.configure do
# Settings specified here will take precedence over those in config/application.rb # Settings specified here will take precedence over those in config/application.rb

View File

@ -1,4 +1,6 @@
class Float # coding: UTF-8
class Float
def self.random_latitude def self.random_latitude
rand(40) * [1,-1][rand(2)] + (rand(10000.0) / 1000.0) rand(40) * [1,-1][rand(2)] + (rand(10000.0) / 1000.0)

View File

@ -1,3 +1,4 @@
# encoding: utf-8
require_relative '../../services/data-repository/backend/sequel' require_relative '../../services/data-repository/backend/sequel'
require_relative '../../app/models/visualization/collection' require_relative '../../app/models/visualization/collection'
require_relative '../../app/models/synchronization/collection' require_relative '../../app/models/synchronization/collection'

View File

@ -1,3 +1,5 @@
# coding: UTF-8
class String class String
def self.random(length=10) def self.random(length=10)
('a'..'z').sort_by {rand}[0,length].join ('a'..'z').sort_by {rand}[0,length].join

View File

@ -1,3 +1,5 @@
# encoding: utf-8
# rubocop:disable Metrics/LineLength, Style/ExtraSpacing, Style/SingleSpaceBeforeFirstArg # rubocop:disable Metrics/LineLength, Style/ExtraSpacing, Style/SingleSpaceBeforeFirstArg
# NOTES: # NOTES:

View File

@ -43,7 +43,6 @@ module.exports = InfowindowBaseView.extend({
label: _t('editor.layers.infowindow.style.infowindow_header_with_url'), label: _t('editor.layers.infowindow.style.infowindow_header_with_url'),
tooltip: _t('editor.layers.infowindow.tooltips.infowindow_header_with_url') tooltip: _t('editor.layers.infowindow.tooltips.infowindow_header_with_url')
} }
]; ];
} }

View File

@ -1,3 +1,4 @@
/** /**
* Common header for vis view ( table | derived ) * Common header for vis view ( table | derived )
* *

View File

@ -1,6 +1,6 @@
<% if (state=='checking') { %> <% if (state=='checking') { %>
<span>检查入</span> <span>检查入</span>
<div class="mini-bar"><span></span></div> <div class="mini-bar"><span></span></div>
<% } %> <% } %>
@ -12,7 +12,7 @@
<% if (state=='preprocessing') { %> <% if (state=='preprocessing') { %>
<span>创建表格</span> <span>创建表格</span>
<div class="mini-bar"><span></span></div> <div class="mini-bar"><span></span></div>
<span class="tip">(可以随意开始新的数据入)</span> <span class="tip">(可以随意开始新的数据入)</span>
<% } %> <% } %>
<% if (state=='complete') { %> <% if (state=='complete') { %>
@ -20,5 +20,5 @@
<% } %> <% } %>
<% if (state=='failure') { %> <% if (state=='failure') { %>
<span class="error"> 入数据时发生了<a href="#show_error" class="error">错误</a></span> <span class="error"> 入数据时发生了<a href="#show_error" class="error">错误</a></span>
<% } %> <% } %>

View File

@ -1,3 +1,5 @@
cdb.admin.mod = cdb.admin.mod || {}; cdb.admin.mod = cdb.admin.mod || {};

View File

@ -1,3 +1,5 @@
# encoding: utf-8
require 'base64' require 'base64'
require 'uri' require 'uri'
require 'openssl' require 'openssl'

View File

@ -1,3 +1,5 @@
# coding: UTF-8
require 'securerandom' require 'securerandom'
require_dependency 'carto/password_validator' require_dependency 'carto/password_validator'
require_dependency 'carto/strong_password_strategy' require_dependency 'carto/strong_password_strategy'

View File

@ -1,42 +1,25 @@
#!/bin/sh #!/bin/sh
set -e if test -n "$1"; then
SUBDOMAIN="$1"
else
echo -n "Enter a subdomain: "; read SUBDOMAIN
fi
SUBDOMAIN="dev" if test -n "$2"; then
PASSWORD="pass1234" PASSWORD="$2"
ADMIN_PASSWORD="pass1234" else
EMAIL="dev@contoso.com" echo -n "Enter a password (cleartext!): "; read PASSWORD
fi
echo "--- Creating databases" if test -n "$3"; then
bundle exec rake cartodb:db:setup EMAIL="$3"
else
echo -n "Enter an email: "; read EMAIL
fi
echo "--- Create '${SUBDOMAIN}' user" echo "--- Creating dev user"
bundle exec rake cartodb:db:create_user --trace SUBDOMAIN="${SUBDOMAIN}" \ bundle exec rake cartodb:db:create_dev_user --trace SUBDOMAIN="${SUBDOMAIN}" \
PASSWORD="${PASSWORD}" ADMIN_PASSWORD="${ADMIN_PASSWORD}" \ PASSWORD="${PASSWORD}" \
EMAIL="${EMAIL}" EMAIL="${EMAIL}"
if test $? -ne 0; then exit 1; fi
# # Update your quota to 100GB
echo "--- Updating quota to 100GB"
bundle exec rake cartodb:db:set_user_quota["${SUBDOMAIN}",102400]
# # Allow unlimited tables to be created
echo "--- Allowing unlimited tables creation"
bundle exec rake cartodb:db:set_unlimited_table_quota["${SUBDOMAIN}"]
# # Allow user to create private tables in addition to public
echo "--- Allowing private tables creation"
bundle exec rake cartodb:db:set_user_private_tables_enabled["${SUBDOMAIN}",'true']
# # Set the account type
echo "--- Setting cartodb account type"
bundle exec rake cartodb:db:set_user_account_type["${SUBDOMAIN}",'[DEDICATED]']
# Set dataservices server
bundle exec rake cartodb:db:configure_geocoder_extension_for_non_org_users[$SUBDOMAIN]
# Set import limits
bundle exec rake cartodb:set_custom_limits_for_user["${SUBDOMAIN}",10240000000,100000000,1]
# Enable sync tables
echo "UPDATE users SET sync_tables_enabled=true WHERE username='${SUBDOMAIN}'" | psql -U postgres -t carto_db_development

View File

@ -1,13 +0,0 @@
#!/bin/bash
# See https://github.com/CartoDB/data-services/issues/228#issuecomment-280037353
# Not run during Docker build phase as it would make the image too big
cd /data-services/geocoder
./geocoder_download_dumps
GEOCODER_DB=`echo "SELECT database_name FROM users WHERE username='geocoder'" | psql -U postgres -t carto_db_development`
./geocoder_restore_dump postgres $GEOCODER_DB db_dumps/*.sql
rm -r db_dumps
chmod +x geocoder_download_patches.sh geocoder_apply_patches.sh
./geocoder_download_patches.sh
./geocoder_apply_patches.sh postgres $GEOCODER_DB data_patches/*.sql
rm -r data_patches

View File

@ -1,40 +0,0 @@
cd /cartodb
bundle exec rake cartodb:db:create_user --trace SUBDOMAIN="geocoder" \
PASSWORD="pass1234" ADMIN_PASSWORD="pass1234" \
EMAIL="geocoder@contoso.com"
# # Update your quota to 100GB
echo "--- Updating quota to 100GB"
bundle exec rake cartodb:db:set_user_quota[geocoder,102400]
# # Allow unlimited tables to be created
echo "--- Allowing unlimited tables creation"
bundle exec rake cartodb:db:set_unlimited_table_quota[geocoder]
GEOCODER_DB=`echo "SELECT database_name FROM users WHERE username='geocoder'" | psql -U postgres -t carto_db_development`
psql -U postgres $GEOCODER_DB < /cartodb/script/geocoder_server.sql
# Import observatory test dataset
psql -U postgres -d $GEOCODER_DB -f /observatory-extension/src/pg/test/fixtures/load_fixtures.sql
# Setup permissions for observatory
psql -U postgres -d $GEOCODER_DB -c "BEGIN;CREATE EXTENSION IF NOT EXISTS observatory VERSION 'dev'; COMMIT" -e
psql -U postgres -d $GEOCODER_DB -c "BEGIN;GRANT SELECT ON ALL TABLES IN SCHEMA cdb_observatory TO geocoder; COMMIT" -e
psql -U postgres -d $GEOCODER_DB -c "BEGIN;GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA cdb_observatory TO geocoder; COMMIT" -e
psql -U postgres -d $GEOCODER_DB -c "BEGIN;GRANT SELECT ON ALL TABLES IN SCHEMA observatory TO geocoder; COMMIT" -e
psql -U postgres -d $GEOCODER_DB -c "BEGIN;GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA observatory TO geocoder; COMMIT" -e
# Setup dataservices client
# dev user
USER_DB=`echo "SELECT database_name FROM users WHERE username='dev'" | psql -U postgres -t carto_db_development`
echo "CREATE EXTENSION cdb_dataservices_client;" | psql -U postgres $USER_DB
echo "SELECT CDB_Conf_SetConf('user_config', '{"'"is_organization"'": false, "'"entity_name"'": "'"dev"'"}');" | psql -U postgres $USER_DB
echo -e "SELECT CDB_Conf_SetConf('geocoder_server_config', '{ \"connection_str\": \"host=localhost port=5432 dbname=${GEOCODER_DB# } user=postgres\"}');" | psql -U postgres $USER_DB
bundle exec rake cartodb:services:set_user_quota['dev',geocoding,100000]
# example organization
ORGANIZATION_DB=`echo "SELECT database_name FROM users WHERE username='admin4example'" | psql -A -U postgres -t carto_db_development`
echo "CREATE EXTENSION cdb_dataservices_client;" | psql -U postgres $ORGANIZATION_DB
echo "SELECT CDB_Conf_SetConf('user_config', '{"'"is_organization"'": true, "'"entity_name"'": "'"example"'"}');" | psql -U postgres $ORGANIZATION_DB
echo -e "SELECT CDB_Conf_SetConf('geocoder_server_config', '{ \"connection_str\": \"host=localhost port=5432 dbname=${GEOCODER_DB# } user=postgres\"}');" | psql -U postgres $ORGANIZATION_DB
bundle exec rake cartodb:services:set_org_quota['example',geocoding,100000]

View File

@ -1,36 +0,0 @@
create extension cdb_geocoder;
create extension plproxy;
create extension observatory;
create extension cdb_dataservices_server;
create extension cdb_dataservices_client;
SELECT CDB_Conf_SetConf(
'redis_metadata_config',
'{"redis_host": "localhost", "redis_port": 6379, "sentinel_master_id": "", "timeout": 0.1, "redis_db": 5}'
);
SELECT CDB_Conf_SetConf(
'redis_metrics_config',
'{"redis_host": "localhost", "redis_port": 6379, "sentinel_master_id": "", "timeout": 0.1, "redis_db": 5}'
);
SELECT CDB_Conf_SetConf(
'user_config',
'{"is_organization": false, "entity_name": "geocoder"}'
);
SELECT CDB_Conf_SetConf(
'server_conf',
'{"environment": "development"}'
);
SELECT cartodb.cdb_conf_setconf('logger_conf', '{"geocoder_log_path": "/tmp/geocodings.log"}');
-- dummy conf from https://github.com/CartoDB/dataservices-api/blob/master/server/extension/test/sql/00_install_test.sql
SELECT cartodb.cdb_conf_setconf('redis_metrics_config', '{"redis_host": "localhost", "redis_port": 6379, "timeout": 0.1, "redis_db": 5}');
SELECT cartodb.cdb_conf_setconf('redis_metadata_config', '{"redis_host": "localhost", "redis_port": 6379, "timeout": 0.1, "redis_db": 5}');
SELECT cartodb.cdb_conf_setconf('heremaps_conf', '{"geocoder": {"app_id": "dummy_id", "app_code": "dummy_code", "geocoder_cost_per_hit": 1}, "isolines": {"app_id": "dummy_id", "app_code": "dummy_code"}}');
SELECT cartodb.cdb_conf_setconf('mapzen_conf', '{"routing": {"api_key": "routing_dummy_api_key", "monthly_quota": 1500000}, "geocoder": {"api_key": "geocoder_dummy_api_key", "monthly_quota": 1500000}, "matrix": {"api_key": "matrix_dummy_api_key", "monthly_quota": 1500000}}');
SELECT cartodb.cdb_conf_setconf('mapbox_conf', '{"routing": {"api_keys": ["routing_dummy_api_key"], "monthly_quota": 1500000}, "geocoder": {"api_keys": ["geocoder_dummy_api_key"], "monthly_quota": 1}, "matrix": {"api_keys": ["matrix_dummy_api_key"], "monthly_quota": 1500000}}');
SELECT cartodb.cdb_conf_setconf('tomtom_conf', '{"routing": {"api_keys": ["routing_dummy_api_key"], "monthly_quota": 1500000}, "geocoder": {"api_keys": ["geocoder_dummy_api_key"], "monthly_quota": 1500000}, "isolines": {"api_keys": ["matrix_dummy_api_key"], "monthly_quota": 1500000}}');
SELECT cartodb.cdb_conf_setconf('logger_conf', '{"geocoder_log_path": "/dev/null"}');
SELECT cartodb.cdb_conf_setconf('data_observatory_conf', '{"connection": {"whitelist": ["ethervoid"], "production": "host=localhost port=5432 dbname=dataservices_db user=geocoder_api", "staging": "host=localhost port=5432 dbname=dataservices_db user=geocoder_api"}, "monthly_quota": 100000}');

View File

@ -1,19 +0,0 @@
ORGANIZATION_NAME="example"
USERNAME="admin4example"
EMAIL="admin@contoso.com"
PASSWORD="pass1234"
bundle exec rake cartodb:db:create_user EMAIL="${EMAIL}" PASSWORD="${PASSWORD}" SUBDOMAIN="${USERNAME}"
bundle exec rake cartodb:db:set_unlimited_table_quota["${USERNAME}"]
bundle exec rake cartodb:db:set_user_quota["${USERNAME}",102400]
bundle exec rake cartodb:db:create_new_organization_with_owner ORGANIZATION_NAME="${ORGANIZATION_NAME}" USERNAME="${USERNAME}" ORGANIZATION_SEATS=100 ORGANIZATION_QUOTA=102400 ORGANIZATION_DISPLAY_NAME="${ORGANIZATION_NAME}"
bundle exec rake cartodb:db:set_organization_quota[$ORGANIZATION_NAME,5000]
bundle exec rake cartodb:db:configure_geocoder_extension_for_organizations[$ORGANIZATION_NAME]
bundle exec rake cartodb:set_custom_limits_for_user["${USERNAME}",10240000000,100000000,1]
# Enable sync tables
echo "UPDATE users SET sync_tables_enabled=true WHERE username='${USERNAME}'" | psql -U postgres -t carto_db_development
# Enable private maps
echo "UPDATE users SET private_maps_enabled = 't'" | psql -U postgres -t carto_db_development
bundle exec rake cartodb:features:enable_feature_for_all_users["new_dashboard"]

View File

@ -1,8 +0,0 @@
#!/bin/bash
while :
do
sleep $SYNC_TABLES_INTERVAL
cd /cartodb
bundle exec rake cartodb:sync_tables[true]
done

View File

@ -1,3 +1,5 @@
# encoding: utf-8
require_relative './spec_helper' require_relative './spec_helper'
require 'capybara/rails' require 'capybara/rails'
require "capybara/dsl" require "capybara/dsl"

View File

@ -1,3 +1,4 @@
# encoding: utf-8
require_relative '../spec_helper' require_relative '../spec_helper'
require_relative '../../app/connectors/importer' require_relative '../../app/connectors/importer'
require_relative '../doubles/result' require_relative '../doubles/result'

View File

@ -1,3 +1,5 @@
# encoding: utf-8
module Doubles module Doubles
class Request class Request

View File

@ -1,3 +1,5 @@
# encoding: utf-8
module CartoDB module CartoDB
module Doubles module Doubles
module Importer2 module Importer2

View File

@ -1,3 +1,5 @@
# encoding: utf-8
module CartoDB module CartoDB
module Doubles module Doubles
module Visualization module Visualization

View File

@ -1,3 +1,4 @@
# encoding: utf-8
require 'helpers/unique_names_helper' require 'helpers/unique_names_helper'
include UniqueNamesHelper include UniqueNamesHelper

View File

@ -1,3 +1,4 @@
# encoding: utf-8
require_relative '../support/factories/users' require_relative '../support/factories/users'
require 'helpers/unique_names_helper' require 'helpers/unique_names_helper'

View File

@ -1,3 +1,5 @@
# encoding: utf-8
require_relative '../support/factories/tables' require_relative '../support/factories/tables'
require 'helpers/unique_names_helper' require 'helpers/unique_names_helper'

View File

@ -1,3 +1,5 @@
# encoding: utf-8
require_relative '../../spec_helper_min.rb' require_relative '../../spec_helper_min.rb'
require_relative '../../../lib/carto/bolt.rb' require_relative '../../../lib/carto/bolt.rb'

View File

@ -1,3 +1,5 @@
# encoding: utf-8
require_relative '../../../../lib/carto/db/sanitize.rb' require_relative '../../../../lib/carto/db/sanitize.rb'
module Carto module Carto

View File

@ -1,3 +1,5 @@
# encoding: utf-8
require 'carto/db/sql_interface' require 'carto/db/sql_interface'
require_relative '../../../spec_helper' require_relative '../../../spec_helper'

View File

@ -1,3 +1,5 @@
# encoding: utf-8
require_relative '../../../spec_helper_min.rb' require_relative '../../../spec_helper_min.rb'
require 'carto/db/user_schema' require 'carto/db/user_schema'

View File

@ -1,3 +1,5 @@
# encoding: utf-8
require 'spec_helper_min' require 'spec_helper_min'
module Carto module Carto

View File

@ -1,3 +1,5 @@
# encoding: utf-8
require_relative '../../../lib/carto/email_domain_validator.rb' require_relative '../../../lib/carto/email_domain_validator.rb'
module Carto module Carto

View File

@ -1,3 +1,5 @@
# encoding: utf-8
require_relative '../../../../lib/carto/file_system/sanitize.rb' require_relative '../../../../lib/carto/file_system/sanitize.rb'
module Carto module Carto

View File

@ -1,3 +1,5 @@
# encoding: utf-8
require 'spec_helper_min' require 'spec_helper_min'
module Carto module Carto

View File

@ -1,3 +1,5 @@
# encoding: utf-8
require 'spec_helper_min' require 'spec_helper_min'
module Carto module Carto

View File

@ -1,3 +1,5 @@
# encoding: utf-8
require_relative '../../../spec_helper' require_relative '../../../spec_helper'
require 'rspec/core' require 'rspec/core'

View File

@ -1,3 +1,5 @@
# encoding: utf-8
require_relative '../../../spec_helper_min' require_relative '../../../spec_helper_min'
require_relative '../../../../lib/carto/named_maps/template' require_relative '../../../../lib/carto/named_maps/template'

View File

@ -1,3 +1,5 @@
# encoding: utf-8
require 'spec_helper_min' require 'spec_helper_min'
module Carto module Carto

View File

@ -1,3 +1,5 @@
# encoding: utf-8
require 'spec_helper_min' require 'spec_helper_min'
module Carto module Carto

View File

@ -1,3 +1,5 @@
# encoding: utf-8
require 'spec_helper_min' require 'spec_helper_min'
module Carto module Carto

View File

@ -1,3 +1,5 @@
# encoding: utf-8
require_relative '../../../lib/carto/valid_table_name_proposer.rb' require_relative '../../../lib/carto/valid_table_name_proposer.rb'
module Carto module Carto

View File

@ -1,3 +1,4 @@
# encoding: utf-8
require_relative '../../../simplecov_helper' require_relative '../../../simplecov_helper'
require 'rspec/core' require 'rspec/core'
require 'rspec/expectations' require 'rspec/expectations'

View File

@ -1,3 +1,5 @@
# coding: UTF-8
require 'spec_helper' require 'spec_helper'
describe CartoDB do describe CartoDB do

View File

@ -1,3 +1,5 @@
# encoding: utf-8
require 'spec_helper_min' require 'spec_helper_min'
require 'support/helpers' require 'support/helpers'
require 'helpers/account_types_helper' require 'helpers/account_types_helper'

View File

@ -1,3 +1,4 @@
# encoding: utf-8
require 'rspec/core' require 'rspec/core'
require 'rspec/expectations' require 'rspec/expectations'
require 'rspec/mocks' require 'rspec/mocks'

View File

@ -1,3 +1,4 @@
# encoding: utf-8
# This file provides a minimal Rails integration test environment with an empty database, without users. # This file provides a minimal Rails integration test environment with an empty database, without users.
require 'simplecov_helper' require 'simplecov_helper'
require 'rspec_configuration' require 'rspec_configuration'