OmniSciDB  c1a53651b2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ddl_utils::FilePathWhitelist Class Reference

#include <DdlUtils.h>

Static Public Member Functions

static void initialize (const std::string &data_dir, const std::string &allowed_import_paths, const std::string &allowed_export_paths)
 
static void validateWhitelistedFilePath (const std::vector< std::string > &expanded_file_paths, const DataTransferType data_transfer_type)
 
static void clear ()
 

Static Private Attributes

static std::vector< std::string > whitelisted_import_paths_ {}
 
static std::vector< std::string > whitelisted_export_paths_ {}
 

Detailed Description

Definition at line 82 of file DdlUtils.h.

Member Function Documentation

void ddl_utils::FilePathWhitelist::clear ( )
static

Definition at line 880 of file DdlUtils.cpp.

References whitelisted_export_paths_, and whitelisted_import_paths_.

Referenced by QueryRunner::QueryRunner::init(), and loadGeo().

880  {
883 }
static std::vector< std::string > whitelisted_export_paths_
Definition: DdlUtils.h:94
static std::vector< std::string > whitelisted_import_paths_
Definition: DdlUtils.h:93

+ Here is the caller graph for this function:

void ddl_utils::FilePathWhitelist::initialize ( const std::string &  data_dir,
const std::string &  allowed_import_paths,
const std::string &  allowed_export_paths 
)
static

Definition at line 841 of file DdlUtils.cpp.

References CHECK, shared::kDefaultExportDirName, shared::kDefaultImportDirName, ddl_utils::set_whitelisted_paths(), whitelisted_export_paths_, and whitelisted_import_paths_.

Referenced by QueryRunner::QueryRunner::init(), loadGeo(), and CommandLineOptions::validate().

843  {
844  CHECK(!data_dir.empty());
845  CHECK(boost::filesystem::is_directory(data_dir));
846 
847  auto data_dir_path = boost::filesystem::canonical(data_dir);
849  whitelisted_import_paths_.emplace_back(
850  (data_dir_path / shared::kDefaultImportDirName).string());
851 
853  whitelisted_export_paths_.emplace_back(
854  (data_dir_path / shared::kDefaultExportDirName).string());
855 
856  if (!allowed_import_paths.empty()) {
858  "allowed-import-paths", allowed_import_paths, whitelisted_import_paths_);
859  }
860  if (!allowed_export_paths.empty()) {
862  "allowed-export-paths", allowed_export_paths, whitelisted_export_paths_);
863  }
864 }
static std::vector< std::string > whitelisted_export_paths_
Definition: DdlUtils.h:94
const std::string kDefaultExportDirName
const std::string kDefaultImportDirName
static std::vector< std::string > whitelisted_import_paths_
Definition: DdlUtils.h:93
void set_whitelisted_paths(const std::string &config_key, const std::string &config_value, std::vector< std::string > &whitelisted_paths)
Definition: DdlUtils.cpp:818
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ddl_utils::FilePathWhitelist::validateWhitelistedFilePath ( const std::vector< std::string > &  expanded_file_paths,
const DataTransferType  data_transfer_type 
)
static

Definition at line 866 of file DdlUtils.cpp.

References ddl_utils::EXPORT, ddl_utils::IMPORT, UNREACHABLE, ddl_utils::validate_expanded_file_path(), whitelisted_export_paths_, and whitelisted_import_paths_.

Referenced by ddl_utils::validate_allowed_file_path().

868  {
869  for (const auto& path : expanded_file_paths) {
870  if (data_transfer_type == DataTransferType::IMPORT) {
872  } else if (data_transfer_type == DataTransferType::EXPORT) {
874  } else {
875  UNREACHABLE();
876  }
877  }
878 }
static std::vector< std::string > whitelisted_export_paths_
Definition: DdlUtils.h:94
#define UNREACHABLE()
Definition: Logger.h:337
static std::vector< std::string > whitelisted_import_paths_
Definition: DdlUtils.h:93
void validate_expanded_file_path(const std::string &file_path, const std::vector< std::string > &whitelisted_root_paths)
Definition: DdlUtils.cpp:744

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

std::vector< std::string > ddl_utils::FilePathWhitelist::whitelisted_export_paths_ {}
staticprivate

Definition at line 94 of file DdlUtils.h.

Referenced by clear(), initialize(), and validateWhitelistedFilePath().

std::vector< std::string > ddl_utils::FilePathWhitelist::whitelisted_import_paths_ {}
staticprivate

Definition at line 93 of file DdlUtils.h.

Referenced by clear(), initialize(), and validateWhitelistedFilePath().


The documentation for this class was generated from the following files: