OmniSciDB  04ee39c94c
Catalog_Namespace::anonymous_namespace{SysCatalog.cpp} Namespace Reference

Functions

auto get_users (std::unique_ptr< SqliteConnector > &sqliteConnector, const int32_t dbId=-1)
 

Variables

auto append_with_commas
 

Function Documentation

◆ get_users()

auto Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::get_users ( std::unique_ptr< SqliteConnector > &  sqliteConnector,
const int32_t  dbId = -1 
)

Definition at line 1192 of file SysCatalog.cpp.

References Catalog_Namespace::SysCatalog::getUserGrantee(), Grantee::hasAnyPrivilegesOnDb(), and Catalog_Namespace::SysCatalog::instance().

Referenced by Catalog_Namespace::SysCatalog::getAllUserMetadata(), and MapDHandler::max_bytes_for_thrift().

1193  {
1194  sqliteConnector->query("SELECT userid, name, issuper FROM mapd_users");
1195  int numRows = sqliteConnector->getNumRows();
1196  list<UserMetadata> user_list;
1197  const bool return_all_users = dbId == -1;
1198  auto has_any_privilege = [&return_all_users, &dbId](const std::string& name) {
1199  if (!return_all_users) {
1200  const auto grantee = SysCatalog::instance().getUserGrantee(name);
1201  return grantee ? grantee->hasAnyPrivilegesOnDb(dbId, false) : false;
1202  }
1203  return true;
1204  };
1205  auto add_user = [&user_list, &has_any_privilege](
1206  const int32_t id, const std::string& name, const bool super) {
1207  if (has_any_privilege(name)) {
1208  user_list.emplace_back(id, name, "", super, -1);
1209  };
1210  };
1211  for (int r = 0; r < numRows; ++r) {
1212  add_user(sqliteConnector->getData<int>(r, 0),
1213  sqliteConnector->getData<string>(r, 1),
1214  sqliteConnector->getData<bool>(r, 2));
1215  }
1216  return user_list;
1217 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ append_with_commas

auto Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::append_with_commas
Initial value:
= [](string& s, const string& t) {
if (!s.empty()) {
s += ", ";
}
s += t;
}

Definition at line 802 of file SysCatalog.cpp.

Referenced by Catalog_Namespace::SysCatalog::alterUser().