OmniSciDB  06b3bd477c
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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

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

Definition at line 1253 of file SysCatalog.cpp.

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

1254  {
1255  sqliteConnector->query("SELECT userid, name, issuper, can_login FROM mapd_users");
1256  int numRows = sqliteConnector->getNumRows();
1257  list<UserMetadata> user_list;
1258  const bool return_all_users = dbId == -1;
1259  auto has_any_privilege = [&return_all_users, &dbId](const std::string& name) {
1260  if (!return_all_users) {
1261  const auto grantee = SysCatalog::instance().getUserGrantee(name);
1262  return grantee ? grantee->hasAnyPrivilegesOnDb(dbId, false) : false;
1263  }
1264  return true;
1265  };
1266  auto add_user = [&user_list, &has_any_privilege](const int32_t id,
1267  const std::string& name,
1268  const bool super,
1269  const bool can_login) {
1270  if (has_any_privilege(name)) {
1271  user_list.emplace_back(id, name, "", super, -1, can_login);
1272  };
1273  };
1274  for (int r = 0; r < numRows; ++r) {
1275  add_user(sqliteConnector->getData<int>(r, 0),
1276  sqliteConnector->getData<string>(r, 1),
1277  sqliteConnector->getData<bool>(r, 2),
1278  sqliteConnector->getData<bool>(r, 3));
1279  }
1280  return user_list;
1281 }

+ Here is the caller graph for this function:

Variable Documentation

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 852 of file SysCatalog.cpp.

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