OmniSciDB  94e8789169
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SysCatalog.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 OmniSci, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
29 #ifndef SYS_CATALOG_H
30 #define SYS_CATALOG_H
31 
32 #include <atomic>
33 #include <cstdint>
34 #include <ctime>
35 #include <limits>
36 #include <list>
37 #include <map>
38 #include <mutex>
39 #include <string>
40 #include <unordered_map>
41 #include <utility>
42 #include <vector>
43 
44 #include "tbb/concurrent_hash_map.h"
45 
46 #include "Grantee.h"
47 #include "ObjectRoleDescriptor.h"
48 #include "PkiServer.h"
49 
50 #include "../DataMgr/DataMgr.h"
51 #include "../SqliteConnector/SqliteConnector.h"
52 #include "LeafHostInfo.h"
53 
54 #include "../Calcite/Calcite.h"
55 #include "../Shared/mapd_shared_mutex.h"
56 
57 const std::string OMNISCI_SYSTEM_CATALOG = "omnisci_system_catalog";
58 const std::string OMNISCI_DEFAULT_DB = "omnisci";
59 const std::string OMNISCI_ROOT_USER = "admin";
60 const int OMNISCI_ROOT_USER_ID = 0;
61 const std::string OMNISCI_ROOT_USER_ID_STR = "0";
62 const std::string OMNISCI_ROOT_PASSWD_DEFAULT = "HyperInteractive";
63 
64 class Calcite;
65 
66 namespace Catalog_Namespace {
67 
68 /*
69  * @type UserMetadata
70  * @brief metadata for a db user
71  */
72 struct UserMetadata {
73  UserMetadata(int32_t u,
74  const std::string& n,
75  const std::string& p,
76  bool s,
77  int32_t d,
78  bool l)
79  : userId(u)
80  , userName(n)
81  , passwd_hash(p)
82  , isSuper(s)
83  , defaultDbId(d)
84  , can_login(l) {}
86  UserMetadata(UserMetadata const& user_meta)
87  : UserMetadata(user_meta.userId,
88  user_meta.userName,
89  user_meta.passwd_hash,
90  user_meta.isSuper.load(),
91  user_meta.defaultDbId,
92  user_meta.can_login) {}
93  int32_t userId;
94  std::string userName;
95  std::string passwd_hash;
96  std::atomic<bool> isSuper{false};
97  int32_t defaultDbId;
98  bool can_login{true};
99 
100  // Return a string that is safe to log for the username based on --log-user-id.
101  std::string userLoggable() const;
102 };
103 
104 /*
105  * @type DBMetadata
106  * @brief metadata for a database
107  */
108 struct DBMetadata {
109  DBMetadata() : dbId(0), dbOwner(0) {}
110  int32_t dbId;
111  std::string dbName;
112  int32_t dbOwner;
113 };
114 
115 /*
116  * @type DBSummary
117  * @brief summary info for a database
118  */
119 struct DBSummary {
120  std::string dbName;
121  std::string dbOwnerName;
122 };
123 using DBSummaryList = std::list<DBSummary>;
124 
126  public:
127  CommonFileOperations(std::string const& base_path) : base_path_(base_path) {}
128 
129  inline void removeCatalogByFullPath(std::string const& full_path);
130  inline void removeCatalogByName(std::string const& name);
131  inline auto duplicateAndRenameCatalog(std::string const& current_name,
132  std::string const& new_name);
133  inline auto assembleCatalogName(std::string const& name);
134 
135  private:
136  std::string const& base_path_;
137 };
138 
139 /*
140  * @type SysCatalog
141  * @brief class for the system-wide catalog, currently containing user and database
142  * metadata
143  */
145  public:
146  void init(const std::string& basePath,
147  std::shared_ptr<Data_Namespace::DataMgr> dataMgr,
148  const AuthMetadata& authMetadata,
149  std::shared_ptr<Calcite> calcite,
150  bool is_new_db,
151  bool aggregator,
152  const std::vector<LeafHostInfo>& string_dict_hosts);
153 
159  std::shared_ptr<Catalog> login(std::string& db,
160  std::string& username,
161  const std::string& password,
162  UserMetadata& user_meta,
163  bool check_password = true);
164  std::shared_ptr<Catalog> switchDatabase(std::string& dbname,
165  const std::string& username);
166  void createUser(const std::string& name,
167  const std::string& passwd,
168  bool issuper,
169  const std::string& dbname,
170  bool can_login);
171  void dropUser(const std::string& name);
172  void alterUser(const int32_t userid,
173  const std::string* passwd,
174  bool* issuper,
175  const std::string* dbname,
176  bool* can_login);
177  void renameUser(std::string const& old_name, std::string const& new_name);
178  void createDatabase(const std::string& dbname, int owner);
179  void renameDatabase(std::string const& old_name, std::string const& new_name);
180  void dropDatabase(const DBMetadata& db);
181  bool getMetadataForUser(const std::string& name, UserMetadata& user);
182  bool getMetadataForUserById(const int32_t idIn, UserMetadata& user);
183  bool checkPasswordForUser(const std::string& passwd,
184  std::string& name,
185  UserMetadata& user);
186  bool getMetadataForDB(const std::string& name, DBMetadata& db);
188  Calcite& getCalciteMgr() const { return *calciteMgr_; }
189  const std::string& getBasePath() const { return basePath_; }
191  std::list<DBMetadata> getAllDBMetadata();
192  std::list<UserMetadata> getAllUserMetadata();
196  std::list<UserMetadata> getAllUserMetadata(const int64_t dbId);
198  void createDBObject(const UserMetadata& user,
199  const std::string& objectName,
201  const Catalog_Namespace::Catalog& catalog,
202  int32_t objectId = -1);
212  void renameDBObject(const std::string& objectName,
213  const std::string& newName,
215  int32_t objectId,
216  const Catalog_Namespace::Catalog& catalog);
217  void grantDBObjectPrivileges(const std::string& grantee,
218  const DBObject& object,
219  const Catalog_Namespace::Catalog& catalog);
220  void grantDBObjectPrivilegesBatch(const std::vector<std::string>& grantees,
221  const std::vector<DBObject>& objects,
222  const Catalog_Namespace::Catalog& catalog);
223  void revokeDBObjectPrivileges(const std::string& grantee,
224  const DBObject& object,
225  const Catalog_Namespace::Catalog& catalog);
226  void revokeDBObjectPrivilegesBatch(const std::vector<std::string>& grantees,
227  const std::vector<DBObject>& objects,
228  const Catalog_Namespace::Catalog& catalog);
229  void revokeDBObjectPrivilegesFromAll(DBObject object, Catalog* catalog);
231  void revokeDBObjectPrivilegesFromAllBatch(std::vector<DBObject>& objects,
232  Catalog* catalog);
233  void revokeDBObjectPrivilegesFromAllBatch_unsafe(std::vector<DBObject>& objects,
234  Catalog* catalog);
235  void getDBObjectPrivileges(const std::string& granteeName,
236  DBObject& object,
237  const Catalog_Namespace::Catalog& catalog) const;
238  bool verifyDBObjectOwnership(const UserMetadata& user,
239  DBObject object,
240  const Catalog_Namespace::Catalog& catalog);
250  void changeDBObjectOwnership(const UserMetadata& new_owner,
251  const UserMetadata& previous_owner,
252  DBObject object,
253  const Catalog_Namespace::Catalog& catalog,
254  bool revoke_privileges = true);
255  void createRole(const std::string& roleName, const bool& userPrivateRole = false);
256  void dropRole(const std::string& roleName);
257  void grantRoleBatch(const std::vector<std::string>& roles,
258  const std::vector<std::string>& grantees);
259  void grantRole(const std::string& role, const std::string& grantee);
260  void revokeRoleBatch(const std::vector<std::string>& roles,
261  const std::vector<std::string>& grantees);
262  void revokeRole(const std::string& role, const std::string& grantee);
263  // check if the user has any permissions on all the given objects
264  bool hasAnyPrivileges(const UserMetadata& user, std::vector<DBObject>& privObjects);
265  // check if the user has the requested permissions on all the given objects
266  bool checkPrivileges(const UserMetadata& user,
267  const std::vector<DBObject>& privObjects) const;
268  bool checkPrivileges(const std::string& userName,
269  const std::vector<DBObject>& privObjects) const;
270  Grantee* getGrantee(const std::string& name) const;
271  Role* getRoleGrantee(const std::string& name) const;
272  User* getUserGrantee(const std::string& name) const;
273  std::vector<ObjectRoleDescriptor*> getMetadataForObject(int32_t dbId,
274  int32_t dbType,
275  int32_t objectId) const;
276  bool isRoleGrantedToGrantee(const std::string& granteeName,
277  const std::string& roleName,
278  bool only_direct) const;
279  std::vector<std::string> getRoles(bool userPrivateRole,
280  bool isSuper,
281  const std::string& userName);
282  std::vector<std::string> getRoles(const std::string& userName, const int32_t dbId);
283  void revokeDashboardSystemRole(const std::string roleName,
284  const std::vector<std::string> grantees);
285  bool isAggregator() const { return aggregator_; }
286  static SysCatalog& instance() {
287  static SysCatalog sys_cat{};
288  return sys_cat;
289  }
290 
291  void populateRoleDbObjects(const std::vector<DBObject>& objects);
292  std::string name() const { return OMNISCI_DEFAULT_DB; }
295  void syncUserWithRemoteProvider(const std::string& user_name,
296  std::vector<std::string> idp_roles,
297  bool* issuper);
298  std::unordered_map<std::string, std::vector<std::string>> getGranteesOfSharedDashboards(
299  const std::vector<std::string>& dashboard_ids);
300  void check_for_session_encryption(const std::string& pki_cert, std::string& session);
301  std::vector<std::shared_ptr<Catalog>> getCatalogsForAllDbs();
302 
303  std::shared_ptr<Catalog> getDummyCatalog() { return dummyCatalog_; }
304 
305  std::shared_ptr<Catalog> getCatalog(const std::string& dbName);
306  std::shared_ptr<Catalog> getCatalog(const int32_t db_id);
307  std::shared_ptr<Catalog> getCatalog(const std::string& basePath,
308  const DBMetadata& curDB,
309  std::shared_ptr<Data_Namespace::DataMgr> dataMgr,
310  const std::vector<LeafHostInfo>& string_dict_hosts,
311  std::shared_ptr<Calcite> calcite,
312  bool is_new_db);
313 
314  void removeCatalog(const std::string& dbName);
315 
316  private:
317  using GranteeMap = std::map<std::string, Grantee*>;
318  using ObjectRoleDescriptorMap = std::multimap<std::string, ObjectRoleDescriptor*>;
319 
322  , aggregator_(false)
323  , sqliteMutex_()
324  , sharedMutex_()
325  , thread_holding_sqlite_lock(std::thread::id())
326  , thread_holding_write_lock(std::thread::id())
327  , dummyCatalog_(std::make_shared<Catalog>()) {}
328  virtual ~SysCatalog();
329 
330  void initDB();
331  void buildRoleMap();
332  void buildUserRoleMap();
336  void createUserRoles();
337  void addAdminUserRole();
338  void migratePrivileges();
339  void migratePrivileged_old();
340  void updateUserSchema();
345  void loginImpl(std::string& username,
346  const std::string& password,
347  UserMetadata& user_meta);
348  bool checkPasswordForUserImpl(const std::string& passwd,
349  std::string& name,
350  UserMetadata& user);
351 
352  // Here go functions not wrapped into transactions (necessary for nested calls)
353  void grantDefaultPrivilegesToRole_unsafe(const std::string& name, bool issuper);
354  void createRole_unsafe(const std::string& roleName, const bool userPrivateRole = false);
355  void dropRole_unsafe(const std::string& roleName);
356  void grantRoleBatch_unsafe(const std::vector<std::string>& roles,
357  const std::vector<std::string>& grantees);
358  void grantRole_unsafe(const std::string& roleName, const std::string& granteeName);
359  void revokeRoleBatch_unsafe(const std::vector<std::string>& roles,
360  const std::vector<std::string>& grantees);
361  void revokeRole_unsafe(const std::string& roleName, const std::string& granteeName);
362  void updateObjectDescriptorMap(const std::string& roleName,
363  DBObject& object,
364  bool roleType,
366  void deleteObjectDescriptorMap(const std::string& roleName);
367  void deleteObjectDescriptorMap(const std::string& roleName,
368  DBObject& object,
370  void grantDBObjectPrivilegesBatch_unsafe(const std::vector<std::string>& grantees,
371  const std::vector<DBObject>& objects,
372  const Catalog_Namespace::Catalog& catalog);
373  void grantDBObjectPrivileges_unsafe(const std::string& granteeName,
374  const DBObject object,
375  const Catalog_Namespace::Catalog& catalog);
376  void revokeDBObjectPrivilegesBatch_unsafe(const std::vector<std::string>& grantees,
377  const std::vector<DBObject>& objects,
378  const Catalog_Namespace::Catalog& catalog);
379  void revokeDBObjectPrivileges_unsafe(const std::string& granteeName,
380  DBObject object,
381  const Catalog_Namespace::Catalog& catalog);
382  void grantAllOnDatabase_unsafe(const std::string& roleName,
383  DBObject& object,
384  const Catalog_Namespace::Catalog& catalog);
385  void revokeAllOnDatabase_unsafe(const std::string& roleName,
386  int32_t dbId,
387  Grantee* grantee);
388  bool isDashboardSystemRole(const std::string& roleName);
389  void updateUserRoleName(const std::string& roleName, const std::string& newName);
390  void getMetadataWithDefaultDB(std::string& dbname,
391  const std::string& username,
393  UserMetadata& user_meta);
394  bool getMetadataForDBById(const int32_t idIn, DBMetadata& db);
400  bool allowLocalLogin() const;
401 
402  template <typename F, typename... Args>
403  void execInTransaction(F&& f, Args&&... args);
404 
405  std::string basePath_;
408  std::unique_ptr<SqliteConnector> sqliteConnector_;
409 
410  std::shared_ptr<Data_Namespace::DataMgr> dataMgr_;
411  std::unique_ptr<PkiServer> pki_server_;
413  std::shared_ptr<Calcite> calciteMgr_;
414  std::vector<LeafHostInfo> string_dict_hosts_;
417 
418  // contains a map of all the catalog within this system
419  // it is lazy loaded
420  // std::map<std::string, std::shared_ptr<Catalog>> cat_map_;
421  using dbid_to_cat_map = tbb::concurrent_hash_map<std::string, std::shared_ptr<Catalog>>;
423 
424  public:
425  mutable std::mutex sqliteMutex_;
427  mutable std::atomic<std::thread::id> thread_holding_sqlite_lock;
428  mutable std::atomic<std::thread::id> thread_holding_write_lock;
429  static thread_local bool thread_holds_read_lock;
430  // used by catalog when initially creating a catalog instance
431  std::shared_ptr<Catalog> dummyCatalog_;
432 };
433 
434 } // namespace Catalog_Namespace
435 
436 #endif // SYS_CATALOG_H
void revokeAllOnDatabase_unsafe(const std::string &roleName, int32_t dbId, Grantee *grantee)
void revokeDBObjectPrivilegesBatch_unsafe(const std::vector< std::string > &grantees, const std::vector< DBObject > &objects, const Catalog_Namespace::Catalog &catalog)
bool isDashboardSystemRole(const std::string &roleName)
void dropUser(const std::string &name)
Definition: SysCatalog.cpp:857
std::string cat(Ts &&...args)
auto duplicateAndRenameCatalog(std::string const &current_name, std::string const &new_name)
Definition: SysCatalog.cpp:101
SqliteConnector * getSqliteConnector()
Definition: SysCatalog.h:190
class for a per-database catalog. also includes metadata for the current database and the current use...
Definition: Catalog.h:101
void createRole_unsafe(const std::string &roleName, const bool userPrivateRole=false)
void changeDBObjectOwnership(const UserMetadata &new_owner, const UserMetadata &previous_owner, DBObject object, const Catalog_Namespace::Catalog &catalog, bool revoke_privileges=true)
DBObjectType
Definition: DBObject.h:42
void revokeDashboardSystemRole(const std::string roleName, const std::vector< std::string > grantees)
std::map< std::string, Grantee * > GranteeMap
Definition: SysCatalog.h:317
void dropRole(const std::string &roleName)
bool checkPasswordForUser(const std::string &passwd, std::string &name, UserMetadata &user)
void revokeDBObjectPrivileges_unsafe(const std::string &granteeName, DBObject object, const Catalog_Namespace::Catalog &catalog)
UserMetadata(UserMetadata const &user_meta)
Definition: SysCatalog.h:86
void revokeDBObjectPrivilegesFromAll(DBObject object, Catalog *catalog)
bool getMetadataForUser(const std::string &name, UserMetadata &user)
void revokeDBObjectPrivileges(const std::string &grantee, const DBObject &object, const Catalog_Namespace::Catalog &catalog)
void removeCatalog(const std::string &dbName)
std::string name() const
Definition: SysCatalog.h:292
std::atomic< std::thread::id > thread_holding_sqlite_lock
Definition: SysCatalog.h:427
std::shared_ptr< Catalog > getDummyCatalog()
Definition: SysCatalog.h:303
ObjectRoleDescriptorMap objectDescriptorMap_
Definition: SysCatalog.h:407
const std::string OMNISCI_SYSTEM_CATALOG
Definition: SysCatalog.h:57
Definition: Grantee.h:70
Grantee * getGrantee(const std::string &name) const
void dropDatabase(const DBMetadata &db)
void loginImpl(std::string &username, const std::string &password, UserMetadata &user_meta)
Definition: SysCatalog.cpp:765
void createUser(const std::string &name, const std::string &passwd, bool issuper, const std::string &dbname, bool can_login)
Definition: SysCatalog.cpp:804
UserMetadata(int32_t u, const std::string &n, const std::string &p, bool s, int32_t d, bool l)
Definition: SysCatalog.h:73
Definition: Grantee.h:76
bool getMetadataForUserById(const int32_t idIn, UserMetadata &user)
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)
Definition: SysCatalog.cpp:118
void createDBObject(const UserMetadata &user, const std::string &objectName, DBObjectType type, const Catalog_Namespace::Catalog &catalog, int32_t objectId=-1)
void grantRole_unsafe(const std::string &roleName, const std::string &granteeName)
void getDBObjectPrivileges(const std::string &granteeName, DBObject &object, const Catalog_Namespace::Catalog &catalog) const
void grantDBObjectPrivileges_unsafe(const std::string &granteeName, const DBObject object, const Catalog_Namespace::Catalog &catalog)
void alterUser(const int32_t userid, const std::string *passwd, bool *issuper, const std::string *dbname, bool *can_login)
Definition: SysCatalog.cpp:905
void grantRoleBatch(const std::vector< std::string > &roles, const std::vector< std::string > &grantees)
std::unique_ptr< PkiServer > pki_server_
Definition: SysCatalog.h:411
void revokeDBObjectPrivilegesBatch(const std::vector< std::string > &grantees, const std::vector< DBObject > &objects, const Catalog_Namespace::Catalog &catalog)
const AuthMetadata * authMetadata_
Definition: SysCatalog.h:412
void createRole(const std::string &roleName, const bool &userPrivateRole=false)
void grantRoleBatch_unsafe(const std::vector< std::string > &roles, const std::vector< std::string > &grantees)
Data_Namespace::DataMgr & getDataMgr() const
Definition: SysCatalog.h:187
bool checkPrivileges(const UserMetadata &user, const std::vector< DBObject > &privObjects) const
void renameDBObject(const std::string &objectName, const std::string &newName, DBObjectType type, int32_t objectId, const Catalog_Namespace::Catalog &catalog)
static SysCatalog & instance()
Definition: SysCatalog.h:286
auto assembleCatalogName(std::string const &name)
Definition: SysCatalog.cpp:89
void getMetadataWithDefaultDB(std::string &dbname, const std::string &username, Catalog_Namespace::DBMetadata &db_meta, UserMetadata &user_meta)
void grantAllOnDatabase_unsafe(const std::string &roleName, DBObject &object, const Catalog_Namespace::Catalog &catalog)
const std::string OMNISCI_DEFAULT_DB
Definition: SysCatalog.h:58
tbb::concurrent_hash_map< std::string, std::shared_ptr< Catalog >> dbid_to_cat_map
Definition: SysCatalog.h:421
std::shared_timed_mutex mapd_shared_mutex
void renameObjectsInDescriptorMap(DBObject &object, const Catalog_Namespace::Catalog &cat)
bool checkPasswordForUserImpl(const std::string &passwd, std::string &name, UserMetadata &user)
std::shared_ptr< Catalog > login(std::string &db, std::string &username, const std::string &password, UserMetadata &user_meta, bool check_password=true)
Definition: SysCatalog.cpp:739
void revokeRoleBatch_unsafe(const std::vector< std::string > &roles, const std::vector< std::string > &grantees)
void revokeRoleBatch(const std::vector< std::string > &roles, const std::vector< std::string > &grantees)
std::shared_ptr< Data_Namespace::DataMgr > dataMgr_
Definition: SysCatalog.h:410
DBSummaryList getDatabaseListForUser(const UserMetadata &user)
std::shared_ptr< Catalog > switchDatabase(std::string &dbname, const std::string &username)
Definition: SysCatalog.cpp:773
Role * getRoleGrantee(const std::string &name) const
mapd_shared_mutex sharedMutex_
Definition: SysCatalog.h:426
void revokeDBObjectPrivilegesFromAllBatch_unsafe(std::vector< DBObject > &objects, Catalog *catalog)
User * getUserGrantee(const std::string &name) const
void grantDBObjectPrivilegesBatch(const std::vector< std::string > &grantees, const std::vector< DBObject > &objects, const Catalog_Namespace::Catalog &catalog)
void grantDBObjectPrivileges(const std::string &grantee, const DBObject &object, const Catalog_Namespace::Catalog &catalog)
std::unique_ptr< SqliteConnector > sqliteConnector_
Definition: SysCatalog.h:408
CommonFileOperations(std::string const &base_path)
Definition: SysCatalog.h:127
void updateUserRoleName(const std::string &roleName, const std::string &newName)
Definition: SysCatalog.cpp:974
std::list< UserMetadata > getAllUserMetadata()
void grantDBObjectPrivilegesBatch_unsafe(const std::vector< std::string > &grantees, const std::vector< DBObject > &objects, const Catalog_Namespace::Catalog &catalog)
void execInTransaction(F &&f, Args &&...args)
void check_for_session_encryption(const std::string &pki_cert, std::string &session)
Definition: SysCatalog.cpp:796
void syncUserWithRemoteProvider(const std::string &user_name, std::vector< std::string > idp_roles, bool *issuper)
void renameUser(std::string const &old_name, std::string const &new_name)
Definition: SysCatalog.cpp:986
void revokeRole_unsafe(const std::string &roleName, const std::string &granteeName)
std::shared_ptr< Catalog > getCatalog(const std::string &dbName)
bool isRoleGrantedToGrantee(const std::string &granteeName, const std::string &roleName, bool only_direct) const
bool hasAnyPrivileges(const UserMetadata &user, std::vector< DBObject > &privObjects)
void deleteObjectDescriptorMap(const std::string &roleName)
void removeCatalogByName(std::string const &name)
Definition: SysCatalog.cpp:97
const std::string OMNISCI_ROOT_USER
Definition: SysCatalog.h:59
const std::string OMNISCI_ROOT_PASSWD_DEFAULT
Definition: SysCatalog.h:62
void updateObjectDescriptorMap(const std::string &roleName, DBObject &object, bool roleType, const Catalog_Namespace::Catalog &cat)
void grantRole(const std::string &role, const std::string &grantee)
const int OMNISCI_ROOT_USER_ID
Definition: SysCatalog.h:60
std::list< DBMetadata > getAllDBMetadata()
void renameDatabase(std::string const &old_name, std::string const &new_name)
const std::string & getBasePath() const
Definition: SysCatalog.h:189
void revokeDBObjectPrivilegesFromAll_unsafe(DBObject object, Catalog *catalog)
bool verifyDBObjectOwnership(const UserMetadata &user, DBObject object, const Catalog_Namespace::Catalog &catalog)
const std::string OMNISCI_ROOT_USER_ID_STR
Definition: SysCatalog.h:61
std::vector< LeafHostInfo > string_dict_hosts_
Definition: SysCatalog.h:414
bool g_enable_watchdog false
Definition: Execute.cpp:76
std::vector< std::shared_ptr< Catalog > > getCatalogsForAllDbs()
Definition: SysCatalog.cpp:884
std::shared_ptr< Calcite > calciteMgr_
Definition: SysCatalog.h:413
std::unordered_map< std::string, std::vector< std::string > > getGranteesOfSharedDashboards(const std::vector< std::string > &dashboard_ids)
std::list< DBSummary > DBSummaryList
Definition: SysCatalog.h:123
void populateRoleDbObjects(const std::vector< DBObject > &objects)
static thread_local bool thread_holds_read_lock
Definition: SysCatalog.h:429
void grantDefaultPrivilegesToRole_unsafe(const std::string &name, bool issuper)
void revokeRole(const std::string &role, const std::string &grantee)
Calcite & getCalciteMgr() const
Definition: SysCatalog.h:188
std::multimap< std::string, ObjectRoleDescriptor * > ObjectRoleDescriptorMap
Definition: SysCatalog.h:318
string name
Definition: setup.py:44
std::string userLoggable() const
Definition: SysCatalog.cpp:85
bool getMetadataForDBById(const int32_t idIn, DBMetadata &db)
void createDatabase(const std::string &dbname, int owner)
std::shared_ptr< Catalog > dummyCatalog_
Definition: SysCatalog.h:431
void removeCatalogByFullPath(std::string const &full_path)
Definition: SysCatalog.cpp:93
std::vector< ObjectRoleDescriptor * > getMetadataForObject(int32_t dbId, int32_t dbType, int32_t objectId) const
std::atomic< bool > isSuper
Definition: SysCatalog.h:96
bool getMetadataForDB(const std::string &name, DBMetadata &db)
void revokeDBObjectPrivilegesFromAllBatch(std::vector< DBObject > &objects, Catalog *catalog)
void dropRole_unsafe(const std::string &roleName)
std::vector< std::string > getRoles(bool userPrivateRole, bool isSuper, const std::string &userName)
std::atomic< std::thread::id > thread_holding_write_lock
Definition: SysCatalog.h:428