pgLab/pglablib/catalog/PgAuthIdContainer.cpp
eelke 70b842597c Read from pg_roles as only superusers can read pg_authid
Contents is same except password is masked. Password does not seem very important to view as it is encrypted anyway.

Close #53
2019-08-10 14:18:01 +02:00

29 lines
759 B
C++

#include "PgAuthIdContainer.h"
#include "Pgsql_Col.h"
std::string PgAuthIdContainer::getLoadQuery() const
{
std::string result =
"SELECT oid, rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, "
" rolcanlogin, rolreplication, rolconnlimit, rolvaliduntil";
if (minimumVersion(90500))
result += ", rolbypassrls";
result += "\n"
"FROM pg_roles";
return result;
}
PgAuthId PgAuthIdContainer::loadElem(const Pgsql::Row &row)
{
Pgsql::Col col(row);
Oid oid = col.nextValue();
QString name = col.nextValue();
PgAuthId v(m_catalog, oid, name);
col >> v.super >> v.inherit >> v.createRole >> v.createDB
>> v.canlogin >> v.replication >> v.connLimit >> v.validUntil;
if (minimumVersion(90500))
col >> v.bypassRls;
return v;
}