OmniSciDB  21ac014ffc
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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/Restriction.h"
57 
58 const std::string OMNISCI_SYSTEM_CATALOG = "omnisci_system_catalog";
59 const std::string OMNISCI_DEFAULT_DB = "omnisci";
60 const std::string OMNISCI_ROOT_USER = "admin";
61 const int OMNISCI_ROOT_USER_ID = 0;
62 const std::string OMNISCI_ROOT_USER_ID_STR = "0";
63 const std::string OMNISCI_ROOT_PASSWD_DEFAULT = "HyperInteractive";
64 
65 class Calcite;
66 
67 extern std::string g_base_path;
68 
69 namespace Catalog_Namespace {
70 
71 /*
72  * @type UserMetadata
73  * @brief metadata for a db user
74  */
75 struct UserMetadata {
76  UserMetadata(int32_t u,
77  const std::string& n,
78  const std::string& p,
79  bool s,
80  int32_t d,
81  bool l)
82  : userId(u)
83  , userName(n)
84  , passwd_hash(p)
85  , isSuper(s)
86  , defaultDbId(d)
87  , can_login(l) {}
89  UserMetadata(UserMetadata const& user_meta)
90  : UserMetadata(user_meta.userId,
91  user_meta.userName,
92  user_meta.passwd_hash,
93  user_meta.isSuper.load(),
94  user_meta.defaultDbId,
95  user_meta.can_login) {}
96  int32_t userId;
97  std::string userName;
98  std::string passwd_hash;
99  std::atomic<bool> isSuper{false};
100  int32_t defaultDbId;
101  bool can_login{true};
103 
104  // Return a string that is safe to log for the username based on --log-user-id.
105  std::string userLoggable() const;
106 
107  void setRestriction(Restriction in_restriction) { restriction = in_restriction; }
108 };
109 
110 /*
111  * @type DBMetadata
112  * @brief metadata for a database
113  */
114 struct DBMetadata {
115  DBMetadata() : dbId(0), dbOwner(0) {}
116  int32_t dbId;
117  std::string dbName;
118  int32_t dbOwner;
119 };
120 
121 /*
122  * @type DBSummary
123  * @brief summary info for a database
124  */
125 struct DBSummary {
126  std::string dbName;
127  std::string dbOwnerName;
128 };
129 using DBSummaryList = std::list<DBSummary>;
130 
132  public:
133  CommonFileOperations(std::string const& base_path) : base_path_(base_path) {}
134 
135  inline void removeCatalogByFullPath(std::string const& full_path);
136  inline void removeCatalogByName(std::string const& name);
137  inline auto duplicateAndRenameCatalog(std::string const& current_name,
138  std::string const& new_name);
139  inline auto assembleCatalogName(std::string const& name);
140 
141  private:
142  std::string const& base_path_;
143 };
144 
145 /*
146  * @type SysCatalog
147  * @brief class for the system-wide catalog, currently containing user and database
148  * metadata
149  */
151  public:
152  void init(const std::string& basePath,
153  std::shared_ptr<Data_Namespace::DataMgr> dataMgr,
154  const AuthMetadata& authMetadata,
155  std::shared_ptr<Calcite> calcite,
156  bool is_new_db,
157  bool aggregator,
158  const std::vector<LeafHostInfo>& string_dict_hosts);
159 
165  std::shared_ptr<Catalog> login(std::string& db,
166  std::string& username,
167  const std::string& password,
168  UserMetadata& user_meta,
169  bool check_password = true);
170  std::shared_ptr<Catalog> switchDatabase(std::string& dbname,
171  const std::string& username);
172  void createUser(const std::string& name,
173  const std::string& passwd,
174  bool issuper,
175  const std::string& dbname,
176  bool can_login);
177  void dropUser(const std::string& name);
178  void alterUser(const int32_t userid,
179  const std::string* passwd,
180  bool* issuper,
181  const std::string* dbname,
182  bool* can_login);
183  void renameUser(std::string const& old_name, std::string const& new_name);
184  void createDatabase(const std::string& dbname, int owner);
185  void renameDatabase(std::string const& old_name, std::string const& new_name);
186  void dropDatabase(const DBMetadata& db);
187  bool getMetadataForUser(const std::string& name, UserMetadata& user);
188  bool getMetadataForUserById(const int32_t idIn, UserMetadata& user);
189  bool checkPasswordForUser(const std::string& passwd,
190  std::string& name,
191  UserMetadata& user);
192  bool getMetadataForDB(const std::string& name, DBMetadata& db);
193  bool getMetadataForDBById(const int32_t idIn, DBMetadata& db);
195  Calcite& getCalciteMgr() const { return *calciteMgr_; }
196  const std::string& getCatalogBasePath() const { return basePath_; }
198  std::list<DBMetadata> getAllDBMetadata();
199  std::list<UserMetadata> getAllUserMetadata();
203  std::list<UserMetadata> getAllUserMetadata(const int64_t dbId);
205  void createDBObject(const UserMetadata& user,
206  const std::string& objectName,
208  const Catalog_Namespace::Catalog& catalog,
209  int32_t objectId = -1);
219  void renameDBObject(const std::string& objectName,
220  const std::string& newName,
222  int32_t objectId,
223  const Catalog_Namespace::Catalog& catalog);
224  void grantDBObjectPrivileges(const std::string& grantee,
225  const DBObject& object,
226  const Catalog_Namespace::Catalog& catalog);
227  void grantDBObjectPrivilegesBatch(const std::vector<std::string>& grantees,
228  const std::vector<DBObject>& objects,
229  const Catalog_Namespace::Catalog& catalog);
230  void revokeDBObjectPrivileges(const std::string& grantee,
231  const DBObject& object,
232  const Catalog_Namespace::Catalog& catalog);
233  void revokeDBObjectPrivilegesBatch(const std::vector<std::string>& grantees,
234  const std::vector<DBObject>& objects,
235  const Catalog_Namespace::Catalog& catalog);
236  void revokeDBObjectPrivilegesFromAll(DBObject object, Catalog* catalog);
238  void revokeDBObjectPrivilegesFromAllBatch(std::vector<DBObject>& objects,
239  Catalog* catalog);
240  void revokeDBObjectPrivilegesFromAllBatch_unsafe(std::vector<DBObject>& objects,
241  Catalog* catalog);
242  void getDBObjectPrivileges(const std::string& granteeName,
243  DBObject& object,
244  const Catalog_Namespace::Catalog& catalog) const;
245  bool verifyDBObjectOwnership(const UserMetadata& user,
246  DBObject object,
247  const Catalog_Namespace::Catalog& catalog);
257  void changeDBObjectOwnership(const UserMetadata& new_owner,
258  const UserMetadata& previous_owner,
259  DBObject object,
260  const Catalog_Namespace::Catalog& catalog,
261  bool revoke_privileges = true);
262  void createRole(const std::string& roleName, const bool& userPrivateRole = false);
263  void dropRole(const std::string& roleName);
264  void grantRoleBatch(const std::vector<std::string>& roles,
265  const std::vector<std::string>& grantees);
266  void grantRole(const std::string& role, const std::string& grantee);
267  void revokeRoleBatch(const std::vector<std::string>& roles,
268  const std::vector<std::string>& grantees);
269  void revokeRole(const std::string& role, const std::string& grantee);
270  // check if the user has any permissions on all the given objects
271  bool hasAnyPrivileges(const UserMetadata& user, std::vector<DBObject>& privObjects);
272  // check if the user has the requested permissions on all the given objects
273  bool checkPrivileges(const UserMetadata& user,
274  const std::vector<DBObject>& privObjects) const;
275  bool checkPrivileges(const std::string& userName,
276  const std::vector<DBObject>& privObjects) const;
277  Grantee* getGrantee(const std::string& name) const;
278  Role* getRoleGrantee(const std::string& name) const;
279  User* getUserGrantee(const std::string& name) const;
280  std::vector<ObjectRoleDescriptor*> getMetadataForObject(int32_t dbId,
281  int32_t dbType,
282  int32_t objectId) const;
283  bool isRoleGrantedToGrantee(const std::string& granteeName,
284  const std::string& roleName,
285  bool only_direct) const;
286  std::vector<std::string> getRoles(bool userPrivateRole,
287  bool isSuper,
288  const std::string& userName);
289  std::vector<std::string> getRoles(const std::string& userName, const int32_t dbId);
290  void revokeDashboardSystemRole(const std::string roleName,
291  const std::vector<std::string> grantees);
292  bool isAggregator() const { return aggregator_; }
293  static SysCatalog& instance() {
294  if (!instance_) {
295  instance_.reset(new SysCatalog());
296  }
297  return *instance_;
298  }
299 
300  static void destroy() { instance_.reset(); }
301 
302  void populateRoleDbObjects(const std::vector<DBObject>& objects);
303  std::string name() const { return OMNISCI_DEFAULT_DB; }
306  void syncUserWithRemoteProvider(const std::string& user_name,
307  std::vector<std::string> idp_roles,
308  bool* issuper);
309  std::unordered_map<std::string, std::vector<std::string>> getGranteesOfSharedDashboards(
310  const std::vector<std::string>& dashboard_ids);
311  void check_for_session_encryption(const std::string& pki_cert, std::string& session);
312  std::vector<std::shared_ptr<Catalog>> getCatalogsForAllDbs();
313 
314  std::shared_ptr<Catalog> getDummyCatalog() { return dummyCatalog_; }
315 
316  std::shared_ptr<Catalog> getCatalog(const std::string& dbName);
317  std::shared_ptr<Catalog> getCatalog(const int32_t db_id);
318  std::shared_ptr<Catalog> getCatalog(const DBMetadata& curDB, bool is_new_db);
319 
320  void removeCatalog(const std::string& dbName);
321 
322  virtual ~SysCatalog();
323 
324  private:
325  using GranteeMap = std::map<std::string, std::unique_ptr<Grantee>>;
327  std::multimap<std::string, std::unique_ptr<ObjectRoleDescriptor>>;
328 
329  SysCatalog();
330 
331  void initDB();
332  void buildRoleMap();
333  void buildUserRoleMap();
337  void createUserRoles();
338  void addAdminUserRole();
339  void migratePrivileges();
340  void migratePrivileged_old();
341  void updateUserSchema();
346  void loginImpl(std::string& username,
347  const std::string& password,
348  UserMetadata& user_meta);
349  bool checkPasswordForUserImpl(const std::string& passwd,
350  std::string& name,
351  UserMetadata& user);
352 
353  // Here go functions not wrapped into transactions (necessary for nested calls)
354  void grantDefaultPrivilegesToRole_unsafe(const std::string& name, bool issuper);
355  void createRole_unsafe(const std::string& roleName, const bool userPrivateRole = false);
356  void dropRole_unsafe(const std::string& roleName);
357  void grantRoleBatch_unsafe(const std::vector<std::string>& roles,
358  const std::vector<std::string>& grantees);
359  void grantRole_unsafe(const std::string& roleName, const std::string& granteeName);
360  void revokeRoleBatch_unsafe(const std::vector<std::string>& roles,
361  const std::vector<std::string>& grantees);
362  void revokeRole_unsafe(const std::string& roleName, const std::string& granteeName);
363  void updateObjectDescriptorMap(const std::string& roleName,
364  DBObject& object,
365  bool roleType,
367  void deleteObjectDescriptorMap(const std::string& roleName);
368  void deleteObjectDescriptorMap(const std::string& roleName,
369  DBObject& object,
371  void grantDBObjectPrivilegesBatch_unsafe(const std::vector<std::string>& grantees,
372  const std::vector<DBObject>& objects,
373  const Catalog_Namespace::Catalog& catalog);
374  void grantDBObjectPrivileges_unsafe(const std::string& granteeName,
375  const DBObject object,
376  const Catalog_Namespace::Catalog& catalog);
377  void revokeDBObjectPrivilegesBatch_unsafe(const std::vector<std::string>& grantees,
378  const std::vector<DBObject>& objects,
379  const Catalog_Namespace::Catalog& catalog);
380  void revokeDBObjectPrivileges_unsafe(const std::string& granteeName,
381  DBObject object,
382  const Catalog_Namespace::Catalog& catalog);
383  void grantAllOnDatabase_unsafe(const std::string& roleName,
384  DBObject& object,
385  const Catalog_Namespace::Catalog& catalog);
386  void revokeAllOnDatabase_unsafe(const std::string& roleName,
387  int32_t dbId,
388  Grantee* grantee);
389  bool isDashboardSystemRole(const std::string& roleName);
390  void updateUserRoleName(const std::string& roleName, const std::string& newName);
391  void getMetadataWithDefaultDB(std::string& dbname,
392  const std::string& username,
394  UserMetadata& user_meta);
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  static std::unique_ptr<SysCatalog> instance_;
425 
426  public:
427  mutable std::mutex sqliteMutex_;
429  mutable std::atomic<std::thread::id> thread_holding_sqlite_lock;
430  mutable std::atomic<std::thread::id> thread_holding_write_lock;
431  static thread_local bool thread_holds_read_lock;
432  // used by catalog when initially creating a catalog instance
433  std::shared_ptr<Catalog> dummyCatalog_;
434 };
435 
436 } // namespace Catalog_Namespace
437 
438 #endif // SYS_CATALOG_H
std::multimap< std::string, std::unique_ptr< ObjectRoleDescriptor >> ObjectRoleDescriptorMap
Definition: SysCatalog.h:327
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:895
std::string cat(Ts &&...args)
auto duplicateAndRenameCatalog(std::string const &current_name, std::string const &new_name)
Definition: SysCatalog.cpp:140
SqliteConnector * getSqliteConnector()
Definition: SysCatalog.h:197
class for a per-database catalog. also includes metadata for the current database and the current use...
Definition: Catalog.h:102
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)
tuple d
Definition: test_fsi.py:9
DBObjectType
Definition: DBObject.h:42
void revokeDashboardSystemRole(const std::string roleName, const std::vector< std::string > grantees)
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:89
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)
string name
Definition: setup.in.py:72
std::string name() const
Definition: SysCatalog.h:303
static std::unique_ptr< SysCatalog > instance_
Definition: SysCatalog.h:424
std::atomic< std::thread::id > thread_holding_sqlite_lock
Definition: SysCatalog.h:429
std::shared_ptr< Catalog > getDummyCatalog()
Definition: SysCatalog.h:314
ObjectRoleDescriptorMap objectDescriptorMap_
Definition: SysCatalog.h:407
const std::string OMNISCI_SYSTEM_CATALOG
Definition: SysCatalog.h:58
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:804
void createUser(const std::string &name, const std::string &passwd, bool issuper, const std::string &dbname, bool can_login)
Definition: SysCatalog.cpp:842
UserMetadata(int32_t u, const std::string &n, const std::string &p, bool s, int32_t d, bool l)
Definition: SysCatalog.h:76
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:157
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:942
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:194
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:293
auto assembleCatalogName(std::string const &name)
Definition: SysCatalog.cpp:128
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)
std::string g_base_path
Definition: SysCatalog.cpp:62
const std::string & getCatalogBasePath() const
Definition: SysCatalog.h:196
const std::string OMNISCI_DEFAULT_DB
Definition: SysCatalog.h:59
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:778
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:812
Role * getRoleGrantee(const std::string &name) const
mapd_shared_mutex sharedMutex_
Definition: SysCatalog.h:428
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:133
void updateUserRoleName(const std::string &roleName, const std::string &newName)
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:834
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)
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:136
const std::string OMNISCI_ROOT_USER
Definition: SysCatalog.h:60
const std::string OMNISCI_ROOT_PASSWD_DEFAULT
Definition: SysCatalog.h:63
void updateObjectDescriptorMap(const std::string &roleName, DBObject &object, bool roleType, const Catalog_Namespace::Catalog &cat)
void setRestriction(Restriction in_restriction)
Definition: SysCatalog.h:107
void grantRole(const std::string &role, const std::string &grantee)
const int OMNISCI_ROOT_USER_ID
Definition: SysCatalog.h:61
std::list< DBMetadata > getAllDBMetadata()
void renameDatabase(std::string const &old_name, std::string const &new_name)
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:62
std::vector< LeafHostInfo > string_dict_hosts_
Definition: SysCatalog.h:414
std::vector< std::shared_ptr< Catalog > > getCatalogsForAllDbs()
Definition: SysCatalog.cpp:922
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)
char * f
std::list< DBSummary > DBSummaryList
Definition: SysCatalog.h:129
void populateRoleDbObjects(const std::vector< DBObject > &objects)
static thread_local bool thread_holds_read_lock
Definition: SysCatalog.h:431
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:195
std::map< std::string, std::unique_ptr< Grantee >> GranteeMap
Definition: SysCatalog.h:325
std::string userLoggable() const
Definition: SysCatalog.cpp:124
bool getMetadataForDBById(const int32_t idIn, DBMetadata &db)
void createDatabase(const std::string &dbname, int owner)
std::shared_ptr< Catalog > dummyCatalog_
Definition: SysCatalog.h:433
void removeCatalogByFullPath(std::string const &full_path)
Definition: SysCatalog.cpp:132
std::vector< ObjectRoleDescriptor * > getMetadataForObject(int32_t dbId, int32_t dbType, int32_t objectId) const
std::atomic< bool > isSuper
Definition: SysCatalog.h:99
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:430