Make PgAuthId inherit PgServerObject and related changes.

This commit is contained in:
eelke 2018-12-25 16:39:58 +01:00
parent c2c01cf431
commit 0b6c1a8544
8 changed files with 33 additions and 16 deletions

View file

@ -17,9 +17,14 @@ Oid PgServerObject::ownerOid() const
return m_ownerOid;
}
bool PgServerObject::hasOwner() const
{
return m_ownerOid != InvalidOid;
}
QString PgServerObject::ownerName() const
{
return m_owner->name;
return m_owner->objectName();
}
const PgAuthId* PgServerObject::owner() const
@ -76,7 +81,8 @@ QString PgServerObject::grantSql() const
// PUBLIC, no priviliges
grant += PgAcl("=").sql(all_pattern, grant_on_object, column);
// owner no privileges
grant += PgAcl(ownerName() + "=").sql(all_pattern, grant_on_object, column);
if (hasOwner())
grant += PgAcl(ownerName() + "=").sql(all_pattern, grant_on_object, column);
}
return grant;
}