OmniSciDB  addbbd5075
 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 1231 of file SysCatalog.cpp.

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

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

1232  {
1233  sqliteConnector->query("SELECT userid, name, issuper, can_login FROM mapd_users");
1234  int numRows = sqliteConnector->getNumRows();
1235  list<UserMetadata> user_list;
1236  const bool return_all_users = dbId == -1;
1237  auto has_any_privilege = [&return_all_users, &dbId](const std::string& name) {
1238  if (!return_all_users) {
1239  const auto grantee = SysCatalog::instance().getUserGrantee(name);
1240  return grantee ? grantee->hasAnyPrivilegesOnDb(dbId, false) : false;
1241  }
1242  return true;
1243  };
1244  auto add_user = [&user_list, &has_any_privilege](const int32_t id,
1245  const std::string& name,
1246  const bool super,
1247  const bool can_login) {
1248  if (has_any_privilege(name)) {
1249  user_list.emplace_back(id, name, "", super, -1, can_login);
1250  };
1251  };
1252  for (int r = 0; r < numRows; ++r) {
1253  add_user(sqliteConnector->getData<int>(r, 0),
1254  sqliteConnector->getData<string>(r, 1),
1255  sqliteConnector->getData<bool>(r, 2),
1256  sqliteConnector->getData<bool>(r, 3));
1257  }
1258  return user_list;
1259 }

+ Here is the call graph for this function:

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

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