OmniSciDB
085a039ca4
|
#include <SysCatalog.h>
Public Member Functions | |
void | init (const std::string &basePath, std::shared_ptr< Data_Namespace::DataMgr > dataMgr, const AuthMetadata &authMetadata, std::shared_ptr< Calcite > calcite, bool is_new_db, bool aggregator, const std::vector< LeafHostInfo > &string_dict_hosts) |
std::shared_ptr< Catalog > | login (std::string &db, std::string &username, const std::string &password, UserMetadata &user_meta, bool check_password=true) |
std::shared_ptr< Catalog > | switchDatabase (std::string &dbname, const std::string &username) |
UserMetadata | createUser (std::string const &name, UserAlterations alts, bool is_temporary) |
void | dropUser (const std::string &name) |
UserMetadata | alterUser (std::string const &name, UserAlterations alts) |
void | renameUser (std::string const &old_name, std::string const &new_name) |
void | createDatabase (const std::string &dbname, int owner) |
void | renameDatabase (std::string const &old_name, std::string const &new_name) |
void | dropDatabase (const DBMetadata &db) |
std::optional< UserMetadata > | getUser (std::string const &uname) |
std::optional< UserMetadata > | getUser (int32_t const uid) |
std::optional< DBMetadata > | getDB (std::string const &dbname) |
std::optional< DBMetadata > | getDB (int32_t const dbid) |
bool | getMetadataForUser (const std::string &name, UserMetadata &user) |
bool | getMetadataForUserById (const int32_t idIn, UserMetadata &user) |
bool | checkPasswordForUser (const std::string &passwd, std::string &name, UserMetadata &user) |
bool | getMetadataForDB (const std::string &name, DBMetadata &db) |
bool | getMetadataForDBById (const int32_t idIn, DBMetadata &db) |
Data_Namespace::DataMgr & | getDataMgr () const |
Calcite & | getCalciteMgr () const |
const std::string & | getCatalogBasePath () const |
SqliteConnector * | getSqliteConnector () |
std::list< DBMetadata > | getAllDBMetadata () |
std::list< UserMetadata > | getAllUserMetadata () |
std::list< UserMetadata > | getAllUserMetadata (const int64_t dbId) |
DBSummaryList | getDatabaseListForUser (const UserMetadata &user) |
void | createDBObject (const UserMetadata &user, const std::string &objectName, DBObjectType type, const Catalog_Namespace::Catalog &catalog, int32_t objectId=-1) |
void | renameDBObject (const std::string &objectName, const std::string &newName, DBObjectType type, int32_t objectId, const Catalog_Namespace::Catalog &catalog) |
void | grantDBObjectPrivileges (const std::string &grantee, const DBObject &object, const Catalog_Namespace::Catalog &catalog) |
void | grantDBObjectPrivilegesBatch (const std::vector< std::string > &grantees, const std::vector< DBObject > &objects, const Catalog_Namespace::Catalog &catalog) |
void | revokeDBObjectPrivileges (const std::string &grantee, const DBObject &object, const Catalog_Namespace::Catalog &catalog) |
void | revokeDBObjectPrivilegesBatch (const std::vector< std::string > &grantees, const std::vector< DBObject > &objects, const Catalog_Namespace::Catalog &catalog) |
void | revokeDBObjectPrivilegesFromAll (DBObject object, Catalog *catalog) |
void | revokeDBObjectPrivilegesFromAll_unsafe (DBObject object, Catalog *catalog) |
void | revokeDBObjectPrivilegesFromAllBatch (std::vector< DBObject > &objects, Catalog *catalog) |
void | revokeDBObjectPrivilegesFromAllBatch_unsafe (std::vector< DBObject > &objects, Catalog *catalog) |
void | getDBObjectPrivileges (const std::string &granteeName, DBObject &object, const Catalog_Namespace::Catalog &catalog) const |
bool | verifyDBObjectOwnership (const UserMetadata &user, DBObject object, const Catalog_Namespace::Catalog &catalog) |
void | changeDBObjectOwnership (const UserMetadata &new_owner, const UserMetadata &previous_owner, DBObject object, const Catalog_Namespace::Catalog &catalog, bool revoke_privileges=true) |
void | createRole (const std::string &roleName, const bool user_private_role, const bool is_temporary=false) |
void | dropRole (const std::string &roleName, const bool is_temporary=false) |
void | grantRoleBatch (const std::vector< std::string > &roles, const std::vector< std::string > &grantees) |
void | grantRole (const std::string &role, const std::string &grantee, const bool is_temporary=false) |
void | revokeRoleBatch (const std::vector< std::string > &roles, const std::vector< std::string > &grantees) |
void | revokeRole (const std::string &role, const std::string &grantee, const bool is_temporary=false) |
bool | hasAnyPrivileges (const UserMetadata &user, std::vector< DBObject > &privObjects) |
bool | checkPrivileges (const UserMetadata &user, const std::vector< DBObject > &privObjects) const |
bool | checkPrivileges (const std::string &userName, const std::vector< DBObject > &privObjects) const |
Grantee * | getGrantee (const std::string &name) const |
Role * | getRoleGrantee (const std::string &name) const |
User * | getUserGrantee (const std::string &name) const |
std::vector < ObjectRoleDescriptor * > | getMetadataForObject (int32_t dbId, int32_t dbType, int32_t objectId) const |
std::vector< ObjectRoleDescriptor > | getMetadataForAllObjects () const |
bool | isRoleGrantedToGrantee (const std::string &granteeName, const std::string &roleName, bool only_direct) const |
std::vector< std::string > | getRoles (const std::string &user_name, bool effective=true) |
std::vector< std::string > | getRoles (bool include_user_private_role, bool is_super, const std::string &user_name, bool ignore_deleted_user=false) |
std::vector< std::string > | getRoles (const std::string &userName, const int32_t dbId) |
std::set< std::string > | getCreatedRoles () const |
bool | isAggregator () const |
void | populateRoleDbObjects (const std::vector< DBObject > &objects) |
std::string | name () const |
void | renameObjectsInDescriptorMap (DBObject &object, const Catalog_Namespace::Catalog &cat) |
void | syncUserWithRemoteProvider (const std::string &user_name, std::vector< std::string > idp_roles, UserAlterations alts) |
std::unordered_map < std::string, std::vector < std::string > > | getGranteesOfSharedDashboards (const std::vector< std::string > &dashboard_ids) |
void | check_for_session_encryption (const std::string &pki_cert, std::string &session) |
std::vector< Catalog * > | getCatalogsForAllDbs () |
std::shared_ptr< Catalog > | getDummyCatalog () |
std::shared_ptr< Catalog > | getCatalog (const std::string &dbName) |
std::shared_ptr< Catalog > | getCatalog (const int32_t db_id) |
std::shared_ptr< Catalog > | getCatalog (const DBMetadata &curDB, bool is_new_db) |
void | removeCatalog (const std::string &dbName) |
virtual | ~SysCatalog () |
void | reassignObjectOwners (const std::map< int32_t, std::vector< DBObject >> &old_owner_db_objects, int32_t new_owner_id, const Catalog_Namespace::Catalog &catalog) |
bool | hasExecutedMigration (const std::string &migration_name) const |
Static Public Member Functions | |
static SysCatalog & | instance () |
static void | destroy () |
Public Attributes | |
std::mutex | sqliteMutex_ |
mapd_shared_mutex | sharedMutex_ |
std::atomic< std::thread::id > | thread_holding_sqlite_lock |
std::atomic< std::thread::id > | thread_holding_write_lock |
std::shared_ptr< Catalog > | dummyCatalog_ |
std::unordered_map < std::string, std::shared_ptr < UserMetadata > > | temporary_users_by_name_ |
std::unordered_map< int32_t, std::shared_ptr< UserMetadata > > | temporary_users_by_id_ |
int32_t | next_temporary_user_id_ {shared::kTempUserIdRange} |
Static Public Attributes | |
static thread_local bool | thread_holds_read_lock = false |
Private Types | |
using | GranteeMap = std::map< std::string, std::unique_ptr< Grantee >> |
using | ObjectRoleDescriptorMap = std::multimap< std::string, std::unique_ptr< ObjectRoleDescriptor >> |
using | dbid_to_cat_map = tbb::concurrent_hash_map< std::string, std::shared_ptr< Catalog >> |
Private Member Functions | |
SysCatalog () | |
void | initDB () |
void | buildRoleMap () |
void | buildUserRoleMap () |
void | buildObjectDescriptorMap () |
void | rebuildObjectMaps () |
void | checkAndExecuteMigrations () |
void | importDataFromOldMapdDB () |
void | createRoles () |
void | fixRolesMigration () |
void | addAdminUserRole () |
void | migratePrivileges () |
void | migratePrivileged_old () |
void | updateUserSchema () |
void | updatePasswordsToHashes () |
void | updateBlankPasswordsToRandom () |
void | updateSupportUserDeactivation () |
void | migrateDBAccessPrivileges () |
void | loginImpl (std::string &username, const std::string &password, UserMetadata &user_meta) |
bool | checkPasswordForUserImpl (const std::string &passwd, std::string &name, UserMetadata &user) |
void | grantDefaultPrivilegesToRole_unsafe (const std::string &name, bool issuper) |
void | createRole_unsafe (const std::string &roleName, const bool userPrivateRole, const bool is_temporary) |
void | dropRole_unsafe (const std::string &roleName, const bool is_temporary) |
void | grantRoleBatch_unsafe (const std::vector< std::string > &roles, const std::vector< std::string > &grantees) |
void | grantRole_unsafe (const std::string &roleName, const std::string &granteeName, const bool is_temporary) |
void | revokeRoleBatch_unsafe (const std::vector< std::string > &roles, const std::vector< std::string > &grantees) |
void | revokeRole_unsafe (const std::string &roleName, const std::string &granteeName, const bool is_temporary) |
void | updateObjectDescriptorMap (const std::string &roleName, DBObject &object, bool roleType, const Catalog_Namespace::Catalog &cat) |
void | deleteObjectDescriptorMap (const std::string &roleName) |
void | deleteObjectDescriptorMap (const std::string &roleName, DBObject &object, const Catalog_Namespace::Catalog &cat) |
void | grantDBObjectPrivilegesBatch_unsafe (const std::vector< std::string > &grantees, const std::vector< DBObject > &objects, const Catalog_Namespace::Catalog &catalog) |
void | grantDBObjectPrivileges_unsafe (const std::string &granteeName, const DBObject object, const Catalog_Namespace::Catalog &catalog) |
void | revokeDBObjectPrivilegesBatch_unsafe (const std::vector< std::string > &grantees, const std::vector< DBObject > &objects, const Catalog_Namespace::Catalog &catalog) |
void | revokeDBObjectPrivileges_unsafe (const std::string &granteeName, DBObject object, const Catalog_Namespace::Catalog &catalog) |
void | grantAllOnDatabase_unsafe (const std::string &roleName, DBObject &object, const Catalog_Namespace::Catalog &catalog) |
void | revokeAllOnDatabase_unsafe (const std::string &roleName, int32_t dbId, Grantee *grantee) |
bool | isDashboardSystemRole (const std::string &roleName) const |
void | updateUserRoleName (const std::string &roleName, const std::string &newName) |
void | getMetadataWithDefaultDB (std::string &dbname, const std::string &username, Catalog_Namespace::DBMetadata &db_meta, UserMetadata &user_meta) |
bool | allowLocalLogin () const |
template<typename F , typename... Args> | |
void | execInTransaction (F &&f, Args &&...args) |
void | initializeInformationSchemaDb () |
void | recordExecutedMigration (const std::string &migration_name) const |
bool | hasVersionHistoryTable () const |
void | createVersionHistoryTable () const |
auto | yieldTransactionStreamer () |
![]() | |
CommonFileOperations (std::string const &base_path) | |
void | removeCatalogByFullPath (std::string const &full_path) |
void | removeCatalogByName (std::string const &name) |
auto | duplicateAndRenameCatalog (std::string const ¤t_name, std::string const &new_name) |
auto | assembleCatalogName (std::string const &name) |
Private Attributes | |
std::string | basePath_ |
GranteeMap | granteeMap_ |
ObjectRoleDescriptorMap | objectDescriptorMap_ |
std::unique_ptr< SqliteConnector > | sqliteConnector_ |
std::shared_ptr < Data_Namespace::DataMgr > | dataMgr_ |
std::unique_ptr< PkiServer > | pki_server_ |
const AuthMetadata * | authMetadata_ |
std::shared_ptr< Calcite > | calciteMgr_ |
std::vector< LeafHostInfo > | string_dict_hosts_ |
bool | aggregator_ |
dbid_to_cat_map | cat_map_ |
Static Private Attributes | |
static std::unique_ptr < SysCatalog > | instance_ |
Definition at line 166 of file SysCatalog.h.
|
private |
Definition at line 494 of file SysCatalog.h.
|
private |
Definition at line 385 of file SysCatalog.h.
|
private |
Definition at line 387 of file SysCatalog.h.
|
virtual |
Definition at line 217 of file SysCatalog.cpp.
References cat_map_, granteeMap_, and objectDescriptorMap_.
|
private |
Definition at line 208 of file SysCatalog.cpp.
References basePath_.
Referenced by instance().
|
private |
Definition at line 562 of file SysCatalog.cpp.
References createRole_unsafe(), shared::kRootUsername, and sqliteConnector_.
Referenced by checkAndExecuteMigrations().
|
private |
For servers configured to use external authentication providers, determine whether users will be allowed to fallback to local login accounts. If no external providers are configured, returns true.
UserMetadata Catalog_Namespace::SysCatalog::alterUser | ( | std::string const & | name, |
UserAlterations | alts | ||
) |
Definition at line 1080 of file SysCatalog.cpp.
References Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::append_with_commas, Catalog_Namespace::UserMetadata::can_login, Catalog_Namespace::UserAlterations::can_login, CHECK, Catalog_Namespace::DBMetadata::dbId, Catalog_Namespace::UserAlterations::default_db, Catalog_Namespace::UserMetadata::defaultDbId, Catalog_Namespace::g_log_user_id, getMetadataForDB(), getMetadataForUser(), getUser(), anonymous_namespace{SysCatalog.cpp}::hash_with_bcrypt(), Catalog_Namespace::UserAlterations::is_super, Catalog_Namespace::UserMetadata::is_temporary, Catalog_Namespace::UserMetadata::isSuper, name(), Catalog_Namespace::UserAlterations::passwd, Catalog_Namespace::UserMetadata::passwd_hash, sqliteConnector_, temporary_users_by_name_, to_string(), Catalog_Namespace::UserMetadata::userId, VLOG, and Catalog_Namespace::UserAlterations::wouldChange().
Referenced by syncUserWithRemoteProvider().
|
private |
Definition at line 2612 of file SysCatalog.cpp.
References objectDescriptorMap_, sqliteConnector_, and to_string().
Referenced by rebuildObjectMaps().
|
private |
Definition at line 2494 of file SysCatalog.cpp.
References DatabaseDBObjectType, DBObjectKey::fromString(), getGrantee(), granteeMap_, name(), AccessPrivileges::privileges, sqliteConnector_, and to_upper().
Referenced by rebuildObjectMaps().
|
private |
Definition at line 2566 of file SysCatalog.cpp.
References getGrantee(), shared::kRootUsername, and sqliteConnector_.
void Catalog_Namespace::SysCatalog::changeDBObjectOwnership | ( | const UserMetadata & | new_owner, |
const UserMetadata & | previous_owner, | ||
DBObject | object, | ||
const Catalog_Namespace::Catalog & | catalog, | ||
bool | revoke_privileges = true |
||
) |
Change ownership of a DBObject
new_owner | - new owner of DBObject |
previous_owner | - previous owner of DBObject |
object | - DBObject to change ownership of |
catalog | - Catalog instance object exists in |
revoke_privileges | - if true, revoke previous_owner's privileges |
Definition at line 1979 of file SysCatalog.cpp.
References AccessPrivileges::ALL_DASHBOARD, AccessPrivileges::ALL_DATABASE, AccessPrivileges::ALL_SERVER, AccessPrivileges::ALL_TABLE, AccessPrivileges::ALL_VIEW, DashboardDBObjectType, DatabaseDBObjectType, grantDBObjectPrivileges_unsafe(), granteeMap_, Catalog_Namespace::UserMetadata::is_temporary, Catalog_Namespace::UserMetadata::isSuper, objectDescriptorMap_, rebuildObjectMaps(), revokeDBObjectPrivileges_unsafe(), ServerDBObjectType, sqliteConnector_, TableDBObjectType, to_string(), UNREACHABLE, Catalog_Namespace::UserMetadata::userId, Catalog_Namespace::UserMetadata::userName, and ViewDBObjectType.
void Catalog_Namespace::SysCatalog::check_for_session_encryption | ( | const std::string & | pki_cert, |
std::string & | session | ||
) |
Definition at line 861 of file SysCatalog.cpp.
References pki_server_.
|
private |
Definition at line 264 of file SysCatalog.cpp.
References addAdminUserRole(), createRoles(), fixRolesMigration(), migrateDBAccessPrivileges(), migratePrivileged_old(), migratePrivileges(), updateBlankPasswordsToRandom(), updatePasswordsToHashes(), updateSupportUserDeactivation(), and updateUserSchema().
bool Catalog_Namespace::SysCatalog::checkPasswordForUser | ( | const std::string & | passwd, |
std::string & | name, | ||
UserMetadata & | user | ||
) |
Definition at line 1465 of file SysCatalog.cpp.
References checkPasswordForUserImpl().
Referenced by loginImpl().
|
private |
Definition at line 1471 of file SysCatalog.cpp.
References CHECK, getMetadataForUser(), LOG, Catalog_Namespace::UserMetadata::passwd_hash, and logger::WARNING.
Referenced by checkPasswordForUser().
bool Catalog_Namespace::SysCatalog::checkPrivileges | ( | const UserMetadata & | user, |
const std::vector< DBObject > & | privObjects | ||
) | const |
Definition at line 2322 of file SysCatalog.cpp.
References getUserGrantee(), instance(), Catalog_Namespace::UserMetadata::isSuper, Catalog_Namespace::UserMetadata::userLoggable(), and Catalog_Namespace::UserMetadata::userName.
Referenced by Catalog_Namespace::SessionInfo::checkDBAccessPrivileges(), checkPrivileges(), getDatabaseListForUser(), and switchDatabase().
bool Catalog_Namespace::SysCatalog::checkPrivileges | ( | const std::string & | userName, |
const std::vector< DBObject > & | privObjects | ||
) | const |
Definition at line 2342 of file SysCatalog.cpp.
References checkPrivileges(), Catalog_Namespace::g_log_user_id, getMetadataForUser(), and instance().
void Catalog_Namespace::SysCatalog::createDatabase | ( | const std::string & | dbname, |
int | owner | ||
) |
Definition at line 1299 of file SysCatalog.cpp.
References basePath_, cat(), CHECK, DatabaseDBObjectType, g_enable_fsi, getCatalog(), Catalog_Namespace::Catalog::getCustomExpressionsSchema(), Catalog_Namespace::Catalog::getForeignServerSchema(), Catalog_Namespace::Catalog::getForeignTableSchema(), getMetadataForDB(), getMetadataForUserById(), grantAllOnDatabase_unsafe(), shared::kCatalogDirectoryName, shared::kRootUserId, shared::kSystemCatalogName, removeCatalog(), sqliteConnector_, to_string(), to_upper(), and Catalog_Namespace::UserMetadata::userName.
Referenced by initDB(), and initializeInformationSchemaDb().
void Catalog_Namespace::SysCatalog::createDBObject | ( | const UserMetadata & | user, |
const std::string & | objectName, | ||
DBObjectType | type, | ||
const Catalog_Namespace::Catalog & | catalog, | ||
int32_t | objectId = -1 |
||
) |
Definition at line 1708 of file SysCatalog.cpp.
References AccessPrivileges::ALL_DASHBOARD, AccessPrivileges::ALL_DATABASE, AccessPrivileges::ALL_SERVER, AccessPrivileges::ALL_TABLE, DashboardDBObjectType, getUserGrantee(), grantDBObjectPrivileges_unsafe(), Grantee::grantPrivileges(), instance(), Catalog_Namespace::UserMetadata::isSuper, ServerDBObjectType, sqliteConnector_, TableDBObjectType, Catalog_Namespace::UserMetadata::userId, Catalog_Namespace::UserMetadata::userLoggable(), and Catalog_Namespace::UserMetadata::userName.
Referenced by CreateForeignServerCommand::execute(), CreateForeignTableCommand::execute(), and EmbeddedDatabase::DBEngineImpl::importArrowTable().
void Catalog_Namespace::SysCatalog::createRole | ( | const std::string & | roleName, |
const bool | user_private_role, | ||
const bool | is_temporary = false |
||
) |
Definition at line 2652 of file SysCatalog.cpp.
References createRole_unsafe(), and execInTransaction().
Referenced by Catalog_Namespace::Catalog::createOrUpdateDashboardSystemRole().
|
private |
Definition at line 2068 of file SysCatalog.cpp.
References DatabaseDBObjectType, DBObjectKey::dbId, getGrantee(), granteeMap_, Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::insertOrUpdateObjectPrivileges(), shared::kDefaultDbName, DBObjectKey::permissionType, DBObject::setObjectKey(), sqliteConnector_, and to_upper().
Referenced by addAdminUserRole(), createRole(), createUser(), and initDB().
|
private |
Definition at line 350 of file SysCatalog.cpp.
References sqliteConnector_.
Referenced by checkAndExecuteMigrations().
UserMetadata Catalog_Namespace::SysCatalog::createUser | ( | std::string const & | name, |
UserAlterations | alts, | ||
bool | is_temporary | ||
) |
Definition at line 869 of file SysCatalog.cpp.
References Catalog_Namespace::UserAlterations::can_login, CHECK, createRole_unsafe(), Catalog_Namespace::DBMetadata::dbId, Catalog_Namespace::UserAlterations::default_db, Catalog_Namespace::g_log_user_id, g_read_only, getGrantee(), getMetadataForDB(), getMetadataForUser(), getUser(), anonymous_namespace{SysCatalog.cpp}::hash_with_bcrypt(), Catalog_Namespace::UserAlterations::is_super, name(), next_temporary_user_id_, Catalog_Namespace::UserAlterations::passwd, sqliteConnector_, temporary_users_by_id_, temporary_users_by_name_, to_string(), Catalog_Namespace::UserMetadata::userLoggable(), and VLOG.
Referenced by syncUserWithRemoteProvider().
|
private |
Definition at line 2985 of file SysCatalog.cpp.
References sqliteConnector_.
Referenced by recordExecutedMigration().
|
private |
Definition at line 2270 of file SysCatalog.cpp.
References objectDescriptorMap_.
Referenced by dropUser(), and revokeDBObjectPrivileges_unsafe().
|
private |
Definition at line 2283 of file SysCatalog.cpp.
References Catalog_Namespace::DBMetadata::dbId, Catalog_Namespace::Catalog::getCurrentDB(), objectDescriptorMap_, and to_string().
|
inlinestatic |
Definition at line 344 of file SysCatalog.h.
References instance_.
Referenced by main(), EmbeddedDatabase::DBEngineImpl::reset(), and startHeavyDBServer().
void Catalog_Namespace::SysCatalog::dropDatabase | ( | const DBMetadata & | db | ) |
Definition at line 1420 of file SysCatalog.cpp.
References cat(), DashboardDBObjectType, Catalog_Namespace::DBMetadata::dbId, Catalog_Namespace::DBMetadata::dbName, getCatalog(), granteeMap_, removeCatalog(), revokeAllOnDatabase_unsafe(), revokeDBObjectPrivilegesFromAll_unsafe(), sqliteConnector_, TableDBObjectType, run_benchmark_import::tables, and to_string().
Referenced by initializeInformationSchemaDb().
void Catalog_Namespace::SysCatalog::dropRole | ( | const std::string & | roleName, |
const bool | is_temporary = false |
||
) |
Definition at line 2659 of file SysCatalog.cpp.
References dropRole_unsafe(), and execInTransaction().
|
private |
Definition at line 2104 of file SysCatalog.cpp.
References granteeMap_, objectDescriptorMap_, sqliteConnector_, and to_upper().
Referenced by dropRole(), and dropUser().
void Catalog_Namespace::SysCatalog::dropUser | ( | const std::string & | name | ) |
Definition at line 962 of file SysCatalog.cpp.
References CHECK, deleteObjectDescriptorMap(), dropRole_unsafe(), Catalog_Namespace::g_log_user_id, getMetadataForUser(), Catalog_Namespace::UserMetadata::is_temporary, sqliteConnector_, temporary_users_by_id_, temporary_users_by_name_, to_string(), and Catalog_Namespace::UserMetadata::userId.
|
private |
Definition at line 2639 of file SysCatalog.cpp.
References run_benchmark_import::args, anonymous_namespace{Utm.h}::f, and sqliteConnector_.
Referenced by createRole(), dropRole(), grantDBObjectPrivileges(), grantDBObjectPrivilegesBatch(), grantRole(), grantRoleBatch(), revokeDBObjectPrivileges(), revokeDBObjectPrivilegesBatch(), revokeDBObjectPrivilegesFromAll(), revokeDBObjectPrivilegesFromAllBatch(), revokeRole(), and revokeRoleBatch().
|
private |
Definition at line 377 of file SysCatalog.cpp.
References sqliteConnector_.
Referenced by checkAndExecuteMigrations().
list< DBMetadata > Catalog_Namespace::SysCatalog::getAllDBMetadata | ( | ) |
Definition at line 1553 of file SysCatalog.cpp.
References Catalog_Namespace::DBMetadata::dbId, Catalog_Namespace::DBMetadata::dbName, Catalog_Namespace::DBMetadata::dbOwner, and sqliteConnector_.
Referenced by getCatalogsForAllDbs(), and getDatabaseListForUser().
list< UserMetadata > Catalog_Namespace::SysCatalog::getAllUserMetadata | ( | ) |
Definition at line 1613 of file SysCatalog.cpp.
References Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::get_users(), and sqliteConnector_.
Referenced by Catalog_Namespace::anonymous_namespace{Catalog.cpp}::get_user_id_to_user_name_map(), and getDatabaseListForUser().
list< UserMetadata > Catalog_Namespace::SysCatalog::getAllUserMetadata | ( | const int64_t | dbId | ) |
return the users associated with the given DB
Definition at line 1606 of file SysCatalog.cpp.
References Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::get_users(), and sqliteConnector_.
|
inline |
Definition at line 229 of file SysCatalog.h.
References calciteMgr_.
std::shared_ptr< Catalog > Catalog_Namespace::SysCatalog::getCatalog | ( | const std::string & | dbName | ) |
Definition at line 2826 of file SysCatalog.cpp.
References cat_map_, and getMetadataForDB().
Referenced by foreign_storage::cache_blocks(), createDatabase(), foreign_storage::ForeignDataWrapperFactory::createForeignTableProxy(), foreign_storage::AbstractTextFileDataWrapper::createRenderGroupAnalyzers(), foreign_storage::ParquetDataWrapper::createRenderGroupAnalyzers(), dropDatabase(), foreign_storage::ParquetDataWrapper::fetchChunkMetadata(), foreign_storage::ForeignTableSchema::ForeignTableSchema(), foreign_storage::anonymous_namespace{InternalMemoryStatsDataWrapper.cpp}::get_column_name(), foreign_storage::get_foreign_table_for_key(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::get_table_ddl(), foreign_storage::get_table_name(), foreign_storage::ParseBufferRequest::getCatalog(), getCatalogsForAllDbs(), foreign_storage::ParquetImportBatchResult::getChunksAndDictionaries(), foreign_storage::ParquetDataWrapper::getColumnsToInitialize(), foreign_storage::init_chunk_for_column(), foreign_storage::Csv::init_chunk_for_column(), PersistentStorageMgr::isForeignStorage(), foreign_storage::ParquetDataWrapper::loadBuffersUsingLazyParquetChunkLoader(), login(), foreign_storage::AbstractTextFileDataWrapper::populateChunkBuffers(), foreign_storage::AbstractTextFileDataWrapper::populateChunkMetadata(), switchDatabase(), and foreign_storage::AbstractTextFileDataWrapper::updateMetadata().
std::shared_ptr< Catalog > Catalog_Namespace::SysCatalog::getCatalog | ( | const int32_t | db_id | ) |
std::shared_ptr< Catalog > Catalog_Namespace::SysCatalog::getCatalog | ( | const DBMetadata & | curDB, |
bool | is_new_db | ||
) |
Definition at line 2851 of file SysCatalog.cpp.
References basePath_, calciteMgr_, cat(), cat_map_, dataMgr_, Catalog_Namespace::DBMetadata::dbName, and string_dict_hosts_.
|
inline |
std::vector< Catalog * > Catalog_Namespace::SysCatalog::getCatalogsForAllDbs | ( | ) |
Definition at line 1004 of file SysCatalog.cpp.
References getAllDBMetadata(), and getCatalog().
std::set< std::string > Catalog_Namespace::SysCatalog::getCreatedRoles | ( | ) | const |
Definition at line 2483 of file SysCatalog.cpp.
References granteeMap_, and isDashboardSystemRole().
DBSummaryList Catalog_Namespace::SysCatalog::getDatabaseListForUser | ( | const UserMetadata & | user | ) |
Definition at line 1684 of file SysCatalog.cpp.
References AccessPrivileges::ACCESS, checkPrivileges(), DatabaseDBObjectType, Catalog_Namespace::DBSummary::dbName, getAllDBMetadata(), getAllUserMetadata(), DBObject::loadKey(), and DBObject::setPrivileges().
Referenced by ShowDatabasesCommand::execute().
|
inline |
Definition at line 228 of file SysCatalog.h.
References dataMgr_.
Referenced by Executor::clearMemory(), Executor::getExecutor(), foreign_storage::InternalMemoryStatsDataWrapper::initializeObjectsForTable(), and foreign_storage::InternalStorageStatsDataWrapper::initializeObjectsForTable().
|
inline |
Definition at line 209 of file SysCatalog.h.
References getMetadataForDB().
|
inline |
Definition at line 215 of file SysCatalog.h.
References getMetadataForDBById().
void Catalog_Namespace::SysCatalog::getDBObjectPrivileges | ( | const std::string & | granteeName, |
DBObject & | object, | ||
const Catalog_Namespace::Catalog & | catalog | ||
) | const |
Definition at line 2046 of file SysCatalog.cpp.
References getGrantee(), getMetadataForUser(), instance(), and Catalog_Namespace::UserMetadata::isSuper.
|
inline |
Definition at line 358 of file SysCatalog.h.
References dummyCatalog_.
Referenced by Catalog_Namespace::Catalog::getObjForLock().
Grantee * Catalog_Namespace::SysCatalog::getGrantee | ( | const std::string & | name | ) | const |
Definition at line 2353 of file SysCatalog.cpp.
References granteeMap_, and to_upper().
Referenced by buildRoleMap(), buildUserRoleMap(), createRole_unsafe(), createUser(), getDBObjectPrivileges(), getRoleGrantee(), getRoles(), getUserGrantee(), grantDBObjectPrivileges_unsafe(), grantRole_unsafe(), renameDBObject(), renameUser(), revokeDBObjectPrivileges_unsafe(), and revokeRole_unsafe().
std::unordered_map< std::string, std::vector< std::string > > Catalog_Namespace::SysCatalog::getGranteesOfSharedDashboards | ( | const std::vector< std::string > & | dashboard_ids | ) |
Definition at line 2795 of file SysCatalog.cpp.
References DashboardDBObjectType, sqliteConnector_, and to_string().
Referenced by Catalog_Namespace::Catalog::createDashboardSystemRoles().
std::vector< ObjectRoleDescriptor > Catalog_Namespace::SysCatalog::getMetadataForAllObjects | ( | ) | const |
Definition at line 2384 of file SysCatalog.cpp.
References isDashboardSystemRole(), and objectDescriptorMap_.
bool Catalog_Namespace::SysCatalog::getMetadataForDB | ( | const std::string & | name, |
DBMetadata & | db | ||
) |
Definition at line 1654 of file SysCatalog.cpp.
References Catalog_Namespace::DBMetadata::dbId, Catalog_Namespace::DBMetadata::dbName, Catalog_Namespace::DBMetadata::dbOwner, and sqliteConnector_.
Referenced by alterUser(), createDatabase(), createUser(), getCatalog(), getDB(), getMetadataWithDefaultDB(), initializeInformationSchemaDb(), migrateDBAccessPrivileges(), renameDatabase(), and Catalog_Namespace::UserAlterations::wouldChange().
bool Catalog_Namespace::SysCatalog::getMetadataForDBById | ( | const int32_t | idIn, |
DBMetadata & | db | ||
) |
Definition at line 1669 of file SysCatalog.cpp.
References Catalog_Namespace::DBMetadata::dbId, Catalog_Namespace::DBMetadata::dbName, Catalog_Namespace::DBMetadata::dbOwner, sqliteConnector_, and to_string().
Referenced by getDB(), and getMetadataWithDefaultDB().
std::vector< ObjectRoleDescriptor * > Catalog_Namespace::SysCatalog::getMetadataForObject | ( | int32_t | dbId, |
int32_t | dbType, | ||
int32_t | objectId | ||
) | const |
Definition at line 2371 of file SysCatalog.cpp.
References objectDescriptorMap_, and to_string().
Referenced by renameDBObject().
bool Catalog_Namespace::SysCatalog::getMetadataForUser | ( | const std::string & | name, |
UserMetadata & | user | ||
) |
Definition at line 1514 of file SysCatalog.cpp.
References Catalog_Namespace::parseUserMetadataFromSQLite(), sqliteConnector_, and temporary_users_by_name_.
Referenced by alterUser(), checkPasswordForUserImpl(), checkPrivileges(), createUser(), dropUser(), getDBObjectPrivileges(), getMetadataWithDefaultDB(), getRoles(), getUser(), grantDBObjectPrivileges_unsafe(), grantRoleBatch_unsafe(), login(), renameUser(), revokeDBObjectPrivileges_unsafe(), and revokeRoleBatch_unsafe().
bool Catalog_Namespace::SysCatalog::getMetadataForUserById | ( | const int32_t | idIn, |
UserMetadata & | user | ||
) |
Definition at line 1534 of file SysCatalog.cpp.
References Catalog_Namespace::parseUserMetadataFromSQLite(), sqliteConnector_, temporary_users_by_id_, and to_string().
Referenced by createDatabase(), getUser(), populateRoleDbObjects(), and reassignObjectOwners().
|
private |
Definition at line 1618 of file SysCatalog.cpp.
References Catalog_Namespace::DBMetadata::dbName, Catalog_Namespace::UserMetadata::defaultDbId, Catalog_Namespace::g_log_user_id, getMetadataForDB(), getMetadataForDBById(), getMetadataForUser(), shared::kDefaultDbName, to_string(), Catalog_Namespace::UserMetadata::userId, and Catalog_Namespace::UserMetadata::userName.
Referenced by login(), and switchDatabase().
Role * Catalog_Namespace::SysCatalog::getRoleGrantee | ( | const std::string & | name | ) | const |
Definition at line 2362 of file SysCatalog.cpp.
References getGrantee().
Referenced by Catalog_Namespace::Catalog::createDashboardSystemRoles(), Catalog_Namespace::Catalog::createOrUpdateDashboardSystemRole(), grantRole_unsafe(), isRoleGrantedToGrantee(), revokeRole_unsafe(), and syncUserWithRemoteProvider().
std::vector< std::string > Catalog_Namespace::SysCatalog::getRoles | ( | const std::string & | user_name, |
bool | effective = true |
||
) |
Definition at line 2422 of file SysCatalog.cpp.
References getGrantee().
std::vector< std::string > Catalog_Namespace::SysCatalog::getRoles | ( | bool | include_user_private_role, |
bool | is_super, | ||
const std::string & | user_name, | ||
bool | ignore_deleted_user = false |
||
) |
Definition at line 2453 of file SysCatalog.cpp.
References getMetadataForUser(), granteeMap_, isDashboardSystemRole(), and isRoleGrantedToGrantee().
std::vector< std::string > Catalog_Namespace::SysCatalog::getRoles | ( | const std::string & | userName, |
const int32_t | dbId | ||
) |
Definition at line 2432 of file SysCatalog.cpp.
References isDashboardSystemRole(), isRoleGrantedToGrantee(), sqliteConnector_, and to_string().
|
inline |
Definition at line 231 of file SysCatalog.h.
References sqliteConnector_.
|
inline |
Definition at line 197 of file SysCatalog.h.
References getMetadataForUser().
Referenced by alterUser(), createUser(), and syncUserWithRemoteProvider().
|
inline |
Definition at line 203 of file SysCatalog.h.
References getMetadataForUserById().
User * Catalog_Namespace::SysCatalog::getUserGrantee | ( | const std::string & | name | ) | const |
Definition at line 2366 of file SysCatalog.cpp.
References getGrantee().
Referenced by checkPrivileges(), createDBObject(), Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::get_users(), hasAnyPrivileges(), isRoleGrantedToGrantee(), populateRoleDbObjects(), syncUserWithRemoteProvider(), and verifyDBObjectOwnership().
|
private |
Definition at line 1829 of file SysCatalog.cpp.
References AccessPrivileges::ACCESS, AccessPrivileges::ALL_DASHBOARD, AccessPrivileges::ALL_SERVER, AccessPrivileges::ALL_TABLE, AccessPrivileges::ALL_VIEW, DashboardDBObjectType, DatabaseDBObjectType, g_enable_fsi, grantDBObjectPrivileges_unsafe(), ServerDBObjectType, DBObject::setPermissionType(), DBObject::setPrivileges(), TableDBObjectType, AccessPrivileges::VIEW_SQL_EDITOR, and ViewDBObjectType.
Referenced by createDatabase(), and grantDBObjectPrivileges_unsafe().
void Catalog_Namespace::SysCatalog::grantDBObjectPrivileges | ( | const std::string & | grantee, |
const DBObject & | object, | ||
const Catalog_Namespace::Catalog & | catalog | ||
) |
Definition at line 2685 of file SysCatalog.cpp.
References execInTransaction(), and grantDBObjectPrivileges_unsafe().
|
private |
Definition at line 1787 of file SysCatalog.cpp.
References DatabasePrivileges::ALL, CHECK, DatabaseDBObjectType, getGrantee(), getMetadataForUser(), grantAllOnDatabase_unsafe(), Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::insertOrUpdateObjectPrivileges(), instance(), Catalog_Namespace::UserMetadata::is_temporary, Catalog_Namespace::UserMetadata::isSuper, sqliteConnector_, and updateObjectDescriptorMap().
Referenced by changeDBObjectOwnership(), createDBObject(), grantAllOnDatabase_unsafe(), grantDBObjectPrivileges(), and grantDBObjectPrivilegesBatch_unsafe().
void Catalog_Namespace::SysCatalog::grantDBObjectPrivilegesBatch | ( | const std::vector< std::string > & | grantees, |
const std::vector< DBObject > & | objects, | ||
const Catalog_Namespace::Catalog & | catalog | ||
) |
Definition at line 2692 of file SysCatalog.cpp.
References execInTransaction(), and grantDBObjectPrivilegesBatch_unsafe().
Referenced by Catalog_Namespace::Catalog::createOrUpdateDashboardSystemRole().
|
private |
Definition at line 1775 of file SysCatalog.cpp.
References grantDBObjectPrivileges_unsafe().
Referenced by grantDBObjectPrivilegesBatch(), and reassignObjectOwners().
|
private |
void Catalog_Namespace::SysCatalog::grantRole | ( | const std::string & | role, |
const std::string & | grantee, | ||
const bool | is_temporary = false |
||
) |
Definition at line 2668 of file SysCatalog.cpp.
References execInTransaction(), and grantRole_unsafe().
Referenced by syncUserWithRemoteProvider().
|
private |
Definition at line 2141 of file SysCatalog.cpp.
References getGrantee(), getRoleGrantee(), and sqliteConnector_.
Referenced by grantRole(), and grantRoleBatch_unsafe().
void Catalog_Namespace::SysCatalog::grantRoleBatch | ( | const std::vector< std::string > & | roles, |
const std::vector< std::string > & | grantees | ||
) |
Definition at line 2663 of file SysCatalog.cpp.
References execInTransaction(), and grantRoleBatch_unsafe().
Referenced by Catalog_Namespace::Catalog::createDashboardSystemRoles().
|
private |
Definition at line 2126 of file SysCatalog.cpp.
References getMetadataForUser(), grantRole_unsafe(), and Catalog_Namespace::UserMetadata::is_temporary.
Referenced by grantRoleBatch().
bool Catalog_Namespace::SysCatalog::hasAnyPrivileges | ( | const UserMetadata & | user, |
std::vector< DBObject > & | privObjects | ||
) |
Definition at line 2301 of file SysCatalog.cpp.
References getUserGrantee(), instance(), Catalog_Namespace::UserMetadata::isSuper, Catalog_Namespace::UserMetadata::userLoggable(), and Catalog_Namespace::UserMetadata::userName.
bool Catalog_Namespace::SysCatalog::hasExecutedMigration | ( | const std::string & | migration_name | ) | const |
Definition at line 2956 of file SysCatalog.cpp.
References hasVersionHistoryTable(), and sqliteConnector_.
Referenced by initializeInformationSchemaDb().
|
private |
Definition at line 2977 of file SysCatalog.cpp.
References sqliteConnector_.
Referenced by hasExecutedMigration(), and recordExecutedMigration().
|
private |
Definition at line 301 of file SysCatalog.cpp.
References basePath_, logger::ERROR, logger::INFO, shared::kCatalogDirectoryName, shared::kSystemCatalogName, LOG, and sqliteConnector_.
void Catalog_Namespace::SysCatalog::init | ( | const std::string & | basePath, |
std::shared_ptr< Data_Namespace::DataMgr > | dataMgr, | ||
const AuthMetadata & | authMetadata, | ||
std::shared_ptr< Calcite > | calcite, | ||
bool | is_new_db, | ||
bool | aggregator, | ||
const std::vector< LeafHostInfo > & | string_dict_hosts | ||
) |
Definition at line 162 of file SysCatalog.cpp.
References anonymous_namespace{SysCatalog.cpp}::copy_catalog_if_read_only(), shared::kCatalogDirectoryName, and shared::kSystemCatalogName.
|
private |
Definition at line 224 of file SysCatalog.cpp.
References createDatabase(), createRole_unsafe(), anonymous_namespace{SysCatalog.cpp}::hash_with_bcrypt(), shared::kDefaultDbName, shared::kDefaultRootPasswd, shared::kRootUserId, shared::kRootUserIdStr, shared::kRootUsername, and sqliteConnector_.
|
private |
Definition at line 2935 of file SysCatalog.cpp.
References createDatabase(), dropDatabase(), g_enable_system_tables, getMetadataForDB(), hasExecutedMigration(), shared::kInfoSchemaDbName, shared::kInfoSchemaMigrationName, shared::kRootUserId, LOG, recordExecutedMigration(), and logger::WARNING.
|
inlinestatic |
Definition at line 337 of file SysCatalog.h.
References instance_, and SysCatalog().
Referenced by foreign_storage::cache_blocks(), AlterForeignServerCommand::changeForeignServerOwner(), Catalog_Namespace::SessionInfo::checkDBAccessPrivileges(), checkPermissionForTables(), checkPrivileges(), QueryRunner::QueryRunner::clearCpuMemory(), QueryRunner::QueryRunner::clearGpuMemory(), Executor::clearMemory(), Catalog_Namespace::Catalog::createDashboardSystemRoles(), createDBObject(), foreign_storage::ForeignDataWrapperFactory::createForeignTableProxy(), Catalog_Namespace::Catalog::createOrUpdateDashboardSystemRole(), foreign_storage::AbstractTextFileDataWrapper::createRenderGroupAnalyzers(), foreign_storage::ParquetDataWrapper::createRenderGroupAnalyzers(), QueryRunner::QueryRunner::createStatement(), Catalog_Namespace::Catalog::deleteMetadataForDashboards(), CreateForeignServerCommand::execute(), DropForeignServerCommand::execute(), CreateForeignTableCommand::execute(), ShowDatabasesCommand::execute(), ShowUserDetailsCommand::execute(), ShowRolesCommand::execute(), RefreshForeignTablesCommand::execute(), foreign_storage::ParquetDataWrapper::fetchChunkMetadata(), foreign_storage::ForeignTableSchema::ForeignTableSchema(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::get_all_dashboards(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::get_all_role_assignments(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::get_all_tables(), foreign_storage::anonymous_namespace{InternalMemoryStatsDataWrapper.cpp}::get_column_name(), foreign_storage::get_db_name(), foreign_storage::get_foreign_table_for_key(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::get_table_ddl(), foreign_storage::get_table_name(), Catalog_Namespace::anonymous_namespace{Catalog.cpp}::get_user_id_to_user_name_map(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::get_user_name(), QueryRunner::QueryRunner::getBufferPoolStats(), foreign_storage::ParseBufferRequest::getCatalog(), foreign_storage::ParquetImportBatchResult::getChunksAndDictionaries(), foreign_storage::ParquetDataWrapper::getColumnsToInitialize(), getDBObjectPrivileges(), QueryRunner::QueryRunner::getExecutor(), Executor::getExecutor(), QueryRunner::QueryRunner::getMemoryInfo(), Catalog_Namespace::Catalog::getObjForLock(), QueryRunner::QueryRunner::getParsedGlobalQueryHints(), QueryRunner::QueryRunner::getParsedQueryHint(), QueryRunner::QueryRunner::getParsedQueryHints(), QueryRunner::QueryRunner::getQueryInfoForDataRecyclerTest(), QueryRunner::QueryRunner::getRaExecutionSequence(), QueryRunner::QueryRunner::getRelAlgTranslator(), QueryRunner::QueryRunner::getRootNodeFromParsedQuery(), grantDBObjectPrivileges_unsafe(), hasAnyPrivileges(), EmbeddedDatabase::DBEngineImpl::importArrowTable(), foreign_storage::init_chunk_for_column(), foreign_storage::Csv::init_chunk_for_column(), foreign_storage::InternalCatalogDataWrapper::initializeObjectsForTable(), foreign_storage::InternalMemoryStatsDataWrapper::initializeObjectsForTable(), foreign_storage::InternalStorageStatsDataWrapper::initializeObjectsForTable(), PersistentStorageMgr::isForeignStorage(), isRoleGrantedToGrantee(), foreign_storage::ParquetDataWrapper::loadBuffersUsingLazyParquetChunkLoader(), DBObject::loadKey(), main(), foreign_storage::InternalSystemDataWrapper::populateChunkBuffers(), foreign_storage::AbstractTextFileDataWrapper::populateChunkBuffers(), foreign_storage::InternalSystemDataWrapper::populateChunkMetadata(), foreign_storage::AbstractTextFileDataWrapper::populateChunkMetadata(), QueryRunner::QueryRunner::QueryRunner(), Catalog_Namespace::Catalog::recordOwnershipOfObjectsInObjectPermissions(), Catalog_Namespace::Catalog::removeTableFromMap(), AlterForeignServerCommand::renameForeignServer(), revokeDBObjectPrivileges_unsafe(), QueryRunner::QueryRunner::runDDLStatement(), QueryRunner::QueryRunner::runSelectQuery(), QueryRunner::QueryRunner::runSQL(), QueryRunner::QueryRunner::runSQLWithAllowingInterrupt(), EmbeddedDatabase::DBEngineImpl::setDatabase(), foreign_storage::ForeignTableRefreshScheduler::start(), foreign_storage::AbstractTextFileDataWrapper::updateMetadata(), verifyDBObjectOwnership(), and Catalog_Namespace::UserAlterations::wouldChange().
|
inline |
|
private |
Definition at line 2418 of file SysCatalog.cpp.
References SYSTEM_ROLE_TAG().
Referenced by getCreatedRoles(), getMetadataForAllObjects(), and getRoles().
bool Catalog_Namespace::SysCatalog::isRoleGrantedToGrantee | ( | const std::string & | granteeName, |
const std::string & | roleName, | ||
bool | only_direct | ||
) | const |
Definition at line 2396 of file SysCatalog.cpp.
References CHECK, getRoleGrantee(), getUserGrantee(), Grantee::hasRole(), and instance().
Referenced by getRoles().
std::shared_ptr< Catalog > Catalog_Namespace::SysCatalog::login | ( | std::string & | db, |
std::string & | username, | ||
const std::string & | password, | ||
UserMetadata & | user_meta, | ||
bool | check_password = true |
||
) |
logins (connects) a user against a database.
throws a std::exception in all error cases! (including wrong password)
Definition at line 805 of file SysCatalog.cpp.
References Catalog_Namespace::UserMetadata::can_login, getCatalog(), getMetadataForUser(), getMetadataWithDefaultDB(), and loginImpl().
|
private |
Definition at line 831 of file SysCatalog.cpp.
References checkPasswordForUser().
Referenced by login().
|
private |
Definition at line 710 of file SysCatalog.cpp.
References AccessPrivileges::ACCESS, CHECK, DatabaseDBObjectType, DBObjectKey::dbId, Catalog_Namespace::DBMetadata::dbId, Catalog_Namespace::DBMetadata::dbName, Catalog_Namespace::DBMetadata::dbOwner, logger::ERROR, getMetadataForDB(), logger::INFO, Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::insertOrUpdateObjectPrivileges(), shared::kRootUserId, LOG, MAPD_VERSION, DBObjectKey::permissionType, DBObject::setName(), DBObject::setObjectType(), sqliteConnector_, to_string(), DBObject::updatePrivileges(), and AccessPrivileges::VIEW_SQL_EDITOR.
Referenced by checkAndExecuteMigrations().
|
private |
Definition at line 788 of file SysCatalog.cpp.
References sqliteConnector_.
Referenced by checkAndExecuteMigrations().
|
private |
Definition at line 452 of file SysCatalog.cpp.
References AccessPrivileges::ALL_DASHBOARD_MIGRATE, AccessPrivileges::ALL_TABLE_MIGRATE, AccessPrivileges::ALL_VIEW_MIGRATE, DashboardDBObjectType, DatabaseDBObjectType, Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::insertOrUpdateObjectPrivileges(), shared::kRootUserId, AccessPrivileges::NONE, sqliteConnector_, TableDBObjectType, run_benchmark_import::type, and ViewDBObjectType.
Referenced by checkAndExecuteMigrations().
|
inline |
Definition at line 347 of file SysCatalog.h.
References shared::kDefaultDbName.
Referenced by alterUser(), buildRoleMap(), createUser(), and Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::get_users().
void Catalog_Namespace::SysCatalog::populateRoleDbObjects | ( | const std::vector< DBObject > & | objects | ) |
Definition at line 2543 of file SysCatalog.cpp.
References CHECK, getMetadataForUserById(), getUserGrantee(), Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::insertOrUpdateObjectPrivileges(), sqliteConnector_, and Catalog_Namespace::UserMetadata::userName.
Referenced by Catalog_Namespace::Catalog::recordOwnershipOfObjectsInObjectPermissions().
void Catalog_Namespace::SysCatalog::reassignObjectOwners | ( | const std::map< int32_t, std::vector< DBObject >> & | old_owner_db_objects, |
int32_t | new_owner_id, | ||
const Catalog_Namespace::Catalog & | catalog | ||
) |
Reassigns database object ownership from a set of users (old owners) to another user (new owner).
old_owner_db_objects | - map of user ids and database objects whose ownership will be reassigned |
new_owner_id | - id of user who will own reassigned database objects |
catalog | - catalog for database where ownership reassignment occurred |
Definition at line 2880 of file SysCatalog.cpp.
References CHECK, shared::contains(), Catalog_Namespace::Catalog::getDatabaseId(), getMetadataForUserById(), grantDBObjectPrivilegesBatch_unsafe(), granteeMap_, Catalog_Namespace::UserMetadata::isSuper, objectDescriptorMap_, rebuildObjectMaps(), revokeDBObjectPrivilegesBatch_unsafe(), sqliteConnector_, to_string(), and Catalog_Namespace::UserMetadata::userName.
|
private |
Definition at line 2992 of file SysCatalog.cpp.
References buildObjectDescriptorMap(), buildRoleMap(), granteeMap_, and objectDescriptorMap_.
Referenced by changeDBObjectOwnership(), and reassignObjectOwners().
|
private |
Definition at line 2967 of file SysCatalog.cpp.
References createVersionHistoryTable(), hasVersionHistoryTable(), MAPD_VERSION, sqliteConnector_, and to_string().
Referenced by initializeInformationSchemaDb().
void Catalog_Namespace::SysCatalog::removeCatalog | ( | const std::string & | dbName | ) |
Definition at line 2876 of file SysCatalog.cpp.
References cat_map_.
Referenced by createDatabase(), dropDatabase(), and renameDatabase().
void Catalog_Namespace::SysCatalog::renameDatabase | ( | std::string const & | old_name, |
std::string const & | new_name | ||
) |
Definition at line 1255 of file SysCatalog.cpp.
References DatabaseDBObjectType, Catalog_Namespace::CommonFileOperations::duplicateAndRenameCatalog(), getMetadataForDB(), shared::kSystemCatalogName, removeCatalog(), Catalog_Namespace::CommonFileOperations::removeCatalogByFullPath(), sqliteConnector_, to_string(), to_upper(), and yieldTransactionStreamer().
void Catalog_Namespace::SysCatalog::renameDBObject | ( | const std::string & | objectName, |
const std::string & | newName, | ||
DBObjectType | type, | ||
int32_t | objectId, | ||
const Catalog_Namespace::Catalog & | catalog | ||
) |
Renames an DBObject
objectName | - original DBObject name |
newName | - new name of DBObject |
type | - type of DBObject |
objectId | - original DBObject ID |
catalog | - Catalog instance object exists in |
Definition at line 1752 of file SysCatalog.cpp.
References DBObjectKey::dbId, Catalog_Namespace::DBMetadata::dbId, Catalog_Namespace::Catalog::getCurrentDB(), getGrantee(), getMetadataForObject(), DBObjectKey::objectId, DBObjectKey::permissionType, Grantee::renameDbObject(), renameObjectsInDescriptorMap(), DBObject::setObjectKey(), and run_benchmark_import::type.
void Catalog_Namespace::SysCatalog::renameObjectsInDescriptorMap | ( | DBObject & | object, |
const Catalog_Namespace::Catalog & | cat | ||
) |
Definition at line 2241 of file SysCatalog.cpp.
References Catalog_Namespace::DBMetadata::dbId, Catalog_Namespace::Catalog::getCurrentDB(), objectDescriptorMap_, sqliteConnector_, and to_string().
Referenced by renameDBObject().
void Catalog_Namespace::SysCatalog::renameUser | ( | std::string const & | old_name, |
std::string const & | new_name | ||
) |
Definition at line 1206 of file SysCatalog.cpp.
References CHECK, Catalog_Namespace::g_log_user_id, getGrantee(), getMetadataForUser(), sqliteConnector_, temporary_users_by_name_, updateUserRoleName(), and yieldTransactionStreamer().
|
private |
Definition at line 1925 of file SysCatalog.cpp.
References objectDescriptorMap_, Grantee::revokeAllOnDatabase(), sqliteConnector_, temporary_users_by_name_, and to_string().
Referenced by dropDatabase(), and revokeDBObjectPrivileges_unsafe().
void Catalog_Namespace::SysCatalog::revokeDBObjectPrivileges | ( | const std::string & | grantee, |
const DBObject & | object, | ||
const Catalog_Namespace::Catalog & | catalog | ||
) |
Definition at line 2699 of file SysCatalog.cpp.
References execInTransaction(), and revokeDBObjectPrivileges_unsafe().
Referenced by Catalog_Namespace::Catalog::createOrUpdateDashboardSystemRole().
|
private |
Definition at line 1881 of file SysCatalog.cpp.
References DatabasePrivileges::ALL, DatabaseDBObjectType, deleteObjectDescriptorMap(), Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::deleteObjectPrivileges(), getGrantee(), getMetadataForUser(), Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::insertOrUpdateObjectPrivileges(), instance(), Catalog_Namespace::UserMetadata::is_temporary, Catalog_Namespace::UserMetadata::isSuper, revokeAllOnDatabase_unsafe(), sqliteConnector_, and updateObjectDescriptorMap().
Referenced by changeDBObjectOwnership(), revokeDBObjectPrivileges(), revokeDBObjectPrivilegesBatch_unsafe(), and revokeDBObjectPrivilegesFromAll_unsafe().