OmniSciDB  fe05a0c208
 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/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);
194  Calcite& getCalciteMgr() const { return *calciteMgr_; }
195  const std::string& getCatalogBasePath() const { return basePath_; }
197  std::list<DBMetadata> getAllDBMetadata();
198  std::list<UserMetadata> getAllUserMetadata();
202  std::list<UserMetadata> getAllUserMetadata(const int64_t dbId);
204  void createDBObject(const UserMetadata& user,
205  const std::string& objectName,
207  const Catalog_Namespace::Catalog& catalog,
208  int32_t objectId = -1);
218  void renameDBObject(const std::string& objectName,
219  const std::string& newName,
221  int32_t objectId,
222  const Catalog_Namespace::Catalog& catalog);
223  void grantDBObjectPrivileges(const std::string& grantee,
224  const DBObject& object,
225  const Catalog_Namespace::Catalog& catalog);
226  void grantDBObjectPrivilegesBatch(const std::vector<std::string>& grantees,
227  const std::vector<DBObject>& objects,
228  const Catalog_Namespace::Catalog& catalog);
229  void revokeDBObjectPrivileges(const std::string& grantee,
230  const DBObject& object,
231  const Catalog_Namespace::Catalog& catalog);
232  void revokeDBObjectPrivilegesBatch(const std::vector<std::string>& grantees,
233  const std::vector<DBObject>& objects,
234  const Catalog_Namespace::Catalog& catalog);
235  void revokeDBObjectPrivilegesFromAll(DBObject object, Catalog* catalog);
237  void revokeDBObjectPrivilegesFromAllBatch(std::vector<DBObject>& objects,
238  Catalog* catalog);
239  void revokeDBObjectPrivilegesFromAllBatch_unsafe(std::vector<DBObject>& objects,
240  Catalog* catalog);
241  void getDBObjectPrivileges(const std::string& granteeName,
242  DBObject& object,
243  const Catalog_Namespace::Catalog& catalog) const;
244  bool verifyDBObjectOwnership(const UserMetadata& user,
245  DBObject object,
246  const Catalog_Namespace::Catalog& catalog);
256  void changeDBObjectOwnership(const UserMetadata& new_owner,
257  const UserMetadata& previous_owner,
258  DBObject object,
259  const Catalog_Namespace::Catalog& catalog,
260  bool revoke_privileges = true);
261  void createRole(const std::string& roleName, const bool& userPrivateRole = false);
262  void dropRole(const std::string& roleName);
263  void grantRoleBatch(const std::vector<std::string>& roles,
264  const std::vector<std::string>& grantees);
265  void grantRole(const std::string& role, const std::string& grantee);
266  void revokeRoleBatch(const std::vector<std::string>& roles,
267  const std::vector<std::string>& grantees);
268  void revokeRole(const std::string& role, const std::string& grantee);
269  // check if the user has any permissions on all the given objects
270  bool hasAnyPrivileges(const UserMetadata& user, std::vector<DBObject>& privObjects);
271  // check if the user has the requested permissions on all the given objects
272  bool checkPrivileges(const UserMetadata& user,
273  const std::vector<DBObject>& privObjects) const;
274  bool checkPrivileges(const std::string& userName,
275  const std::vector<DBObject>& privObjects) const;
276  Grantee* getGrantee(const std::string& name) const;
277  Role* getRoleGrantee(const std::string& name) const;
278  User* getUserGrantee(const std::string& name) const;
279  std::vector<ObjectRoleDescriptor*> getMetadataForObject(int32_t dbId,
280  int32_t dbType,
281  int32_t objectId) const;
282  bool isRoleGrantedToGrantee(const std::string& granteeName,
283  const std::string& roleName,
284  bool only_direct) const;
285  std::vector<std::string> getRoles(bool userPrivateRole,
286  bool isSuper,
287  const std::string& userName);
288  std::vector<std::string> getRoles(const std::string& userName, const int32_t dbId);
289  void revokeDashboardSystemRole(const std::string roleName,
290  const std::vector<std::string> grantees);
291  bool isAggregator() const { return aggregator_; }
292  static SysCatalog& instance() {
293  if (!instance_) {
294  instance_.reset(new SysCatalog());
295  }
296  return *instance_;
297  }
298 
299  static void destroy() { instance_.reset(); }
300 
301  void populateRoleDbObjects(const std::vector<DBObject>& objects);
302  std::string name() const { return OMNISCI_DEFAULT_DB; }
305  void syncUserWithRemoteProvider(const std::string& user_name,
306  std::vector<std::string> idp_roles,
307  bool* issuper);
308  std::unordered_map<std::string, std::vector<std::string>> getGranteesOfSharedDashboards(
309  const std::vector<std::string>& dashboard_ids);
310  void check_for_session_encryption(const std::string& pki_cert, std::string& session);
311  std::vector<std::shared_ptr<Catalog>> getCatalogsForAllDbs();
312 
313  std::shared_ptr<Catalog> getDummyCatalog() { return dummyCatalog_; }
314 
315  std::shared_ptr<Catalog> getCatalog(const std::string& dbName);
316  std::shared_ptr<Catalog> getCatalog(const int32_t db_id);
317  std::shared_ptr<Catalog> getCatalog(const DBMetadata& curDB, bool is_new_db);
318 
319  void removeCatalog(const std::string& dbName);
320 
321  virtual ~SysCatalog();
322 
323  private:
324  using GranteeMap = std::map<std::string, Grantee*>;
325  using ObjectRoleDescriptorMap = std::multimap<std::string, ObjectRoleDescriptor*>;
326 
329  , aggregator_(false)
330  , sqliteMutex_()
331  , sharedMutex_()
332  , thread_holding_sqlite_lock(std::thread::id())
333  , thread_holding_write_lock(std::thread::id())
334  , dummyCatalog_(std::make_shared<Catalog>()) {}
335 
336  void initDB();
337  void buildRoleMap();
338  void buildUserRoleMap();
342  void createUserRoles();
343  void addAdminUserRole();
344  void migratePrivileges();
345  void migratePrivileged_old();
346  void updateUserSchema();
351  void loginImpl(std::string& username,
352  const std::string& password,
353  UserMetadata& user_meta);
354  bool checkPasswordForUserImpl(const std::string& passwd,
355  std::string& name,
356  UserMetadata& user);
357 
358  // Here go functions not wrapped into transactions (necessary for nested calls)
359  void grantDefaultPrivilegesToRole_unsafe(const std::string& name, bool issuper);
360  void createRole_unsafe(const std::string& roleName, const bool userPrivateRole = false);
361  void dropRole_unsafe(const std::string& roleName);
362  void grantRoleBatch_unsafe(const std::vector<std::string>& roles,
363  const std::vector<std::string>& grantees);
364  void grantRole_unsafe(const std::string& roleName, const std::string& granteeName);
365  void revokeRoleBatch_unsafe(const std::vector<std::string>& roles,
366  const std::vector<std::string>& grantees);
367  void revokeRole_unsafe(const std::string& roleName, const std::string& granteeName);
368  void updateObjectDescriptorMap(const std::string& roleName,
369  DBObject& object,
370  bool roleType,
372  void deleteObjectDescriptorMap(const std::string& roleName);
373  void deleteObjectDescriptorMap(const std::string& roleName,
374  DBObject& object,
376  void grantDBObjectPrivilegesBatch_unsafe(const std::vector<std::string>& grantees,
377  const std::vector<DBObject>& objects,
378  const Catalog_Namespace::Catalog& catalog);
379  void grantDBObjectPrivileges_unsafe(const std::string& granteeName,
380  const DBObject object,
381  const Catalog_Namespace::Catalog& catalog);
382  void revokeDBObjectPrivilegesBatch_unsafe(const std::vector<std::string>& grantees,
383  const std::vector<DBObject>& objects,
384  const Catalog_Namespace::Catalog& catalog);
385  void revokeDBObjectPrivileges_unsafe(const std::string& granteeName,
386  DBObject object,
387  const Catalog_Namespace::Catalog& catalog);
388  void grantAllOnDatabase_unsafe(const std::string& roleName,
389  DBObject& object,
390  const Catalog_Namespace::Catalog& catalog);
391  void revokeAllOnDatabase_unsafe(const std::string& roleName,
392  int32_t dbId,
393  Grantee* grantee);
394  bool isDashboardSystemRole(const std::string& roleName);
395  void updateUserRoleName(const std::string& roleName, const std::string& newName);
396  void getMetadataWithDefaultDB(std::string& dbname,
397  const std::string& username,
399  UserMetadata& user_meta);
400  bool getMetadataForDBById(const int32_t idIn, DBMetadata& db);
406  bool allowLocalLogin() const;
407 
408  template <typename F, typename... Args>
409  void execInTransaction(F&& f, Args&&... args);
410 
411  std::string basePath_;
414  std::unique_ptr<SqliteConnector> sqliteConnector_;
415 
416  std::shared_ptr<Data_Namespace::DataMgr> dataMgr_;
417  std::unique_ptr<PkiServer> pki_server_;
419  std::shared_ptr<Calcite> calciteMgr_;
420  std::vector<LeafHostInfo> string_dict_hosts_;
423 
424  // contains a map of all the catalog within this system
425  // it is lazy loaded
426  // std::map<std::string, std::shared_ptr<Catalog>> cat_map_;
427  using dbid_to_cat_map = tbb::concurrent_hash_map<std::string, std::shared_ptr<Catalog>>;
429 
430  static std::unique_ptr<SysCatalog> instance_;
431 
432  public:
433  mutable std::mutex sqliteMutex_;
435  mutable std::atomic<std::thread::id> thread_holding_sqlite_lock;
436  mutable std::atomic<std::thread::id> thread_holding_write_lock;
437  static thread_local bool thread_holds_read_lock;
438  // used by catalog when initially creating a catalog instance
439  std::shared_ptr<Catalog> dummyCatalog_;
440 };
441 
442 } // namespace Catalog_Namespace
443 
444 #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:896
std::string cat(Ts &&...args)
auto duplicateAndRenameCatalog(std::string const &current_name, std::string const &new_name)
Definition: SysCatalog.cpp:141
SqliteConnector * getSqliteConnector()
Definition: SysCatalog.h:196
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)
std::map< std::string, Grantee * > GranteeMap
Definition: SysCatalog.h:324
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:302
static std::unique_ptr< SysCatalog > instance_
Definition: SysCatalog.h:430
std::atomic< std::thread::id > thread_holding_sqlite_lock
Definition: SysCatalog.h:435
std::shared_ptr< Catalog > getDummyCatalog()
Definition: SysCatalog.h:313
ObjectRoleDescriptorMap objectDescriptorMap_
Definition: SysCatalog.h:413
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:805
void createUser(const std::string &name, const std::string &passwd, bool issuper, const std::string &dbname, bool can_login)
Definition: SysCatalog.cpp:843
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:158
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:943
void grantRoleBatch(const std::vector< std::string > &roles, const std::vector< std::string > &grantees)
std::unique_ptr< PkiServer > pki_server_
Definition: SysCatalog.h:417
void revokeDBObjectPrivilegesBatch(const std::vector< std::string > &grantees, const std::vector< DBObject > &objects, const Catalog_Namespace::Catalog &catalog)
const AuthMetadata * authMetadata_
Definition: SysCatalog.h:418
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:193
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:292
auto assembleCatalogName(std::string const &name)
Definition: SysCatalog.cpp:129
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:195
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:427
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:779
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:416
DBSummaryList getDatabaseListForUser(const UserMetadata &user)
std::shared_ptr< Catalog > switchDatabase(std::string &dbname, const std::string &username)
Definition: SysCatalog.cpp:813
Role * getRoleGrantee(const std::string &name) const
mapd_shared_mutex sharedMutex_
Definition: SysCatalog.h:434
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:414
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:835
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:137
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:420
bool g_enable_watchdog false
Definition: Execute.cpp:76
std::vector< std::shared_ptr< Catalog > > getCatalogsForAllDbs()
Definition: SysCatalog.cpp:923
std::shared_ptr< Calcite > calciteMgr_
Definition: SysCatalog.h:419
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:437
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:194
std::multimap< std::string, ObjectRoleDescriptor * > ObjectRoleDescriptorMap
Definition: SysCatalog.h:325
std::string userLoggable() const
Definition: SysCatalog.cpp:125
bool getMetadataForDBById(const int32_t idIn, DBMetadata &db)
void createDatabase(const std::string &dbname, int owner)
std::shared_ptr< Catalog > dummyCatalog_
Definition: SysCatalog.h:439
void removeCatalogByFullPath(std::string const &full_path)
Definition: SysCatalog.cpp:133
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:436