PG16 support privilege MAINTAIN

Добавлена поддержка отображения новой привелегии.
This commit is contained in:
lsv 2023-08-02 11:33:42 +05:00
parent 6f7e04671e
commit d7f1687b7c
8 changed files with 27 additions and 11 deletions

View file

@ -26,7 +26,7 @@
#include <wx/arrimpl.cpp>
defaultPrivilegesOn g_defPrivTables('r', wxT("Tables"), wxT("arwdDxt")),
defaultPrivilegesOn g_defPrivTables('r', wxT("Tables"), wxT("arwdDxtm")),
g_defPrivSequences('S', wxT("Sequences"), wxT("rwU")),
g_defPrivFunctions('f', wxT("Functions"), wxT("X")),
g_defPrivTypes('T', wxT("Types"), wxT("U"));

View file

@ -188,7 +188,7 @@ dlgProperty *pgPartitionFactory::CreateDialog(frmMain *frame, pgObject *node, pg
}
dlgTable::dlgTable(pgaFactory *f, frmMain *frame, pgTable *node, pgSchema *sch)
: dlgSecurityProperty(f, frame, node, wxT("dlgTable"), wxT("INSERT,SELECT,UPDATE,DELETE,TRUNCATE,RULE,REFERENCES,TRIGGER"), "arwdDRxt")
: dlgSecurityProperty(f, frame, node, wxT("dlgTable"), wxT("INSERT,SELECT,UPDATE,DELETE,TRUNCATE,RULE,REFERENCES,TRIGGER,MAINTAIN"), "arwdDRxtm")
{
schema = sch;
table = node;
@ -1508,7 +1508,9 @@ wxString dlgTable::GetSql()
if (seclabelPage && connection->BackendMinimumVersion(9, 1))
sql += seclabelPage->GetSqlForSecLabels(wxT("TABLE"), qtIdent(cbSchema->GetValue()) + wxT(".") + qtIdent(GetName()));
if (connection->BackendMinimumVersion(8, 4))
if (connection->BackendMinimumVersion(16, 0))
sql += GetGrant(wxT("arwdDxtm"), wxT("TABLE ") + tabname);
else if (connection->BackendMinimumVersion(8, 4))
sql += GetGrant(wxT("arwdDxt"), wxT("TABLE ") + tabname);
else if (connection->BackendMinimumVersion(8, 2))
sql += GetGrant(wxT("arwdxt"), wxT("TABLE ") + tabname);

View file

@ -1013,8 +1013,10 @@ wxString dlgView::GetSql()
else
AppendOwnerNew(sql, wxT("TABLE ") + qtIdent(cbSchema->GetValue()) + wxT(".") + qtIdent(GetName()));
sql += GetGrant(wxT("arwdRxt"), wxT("TABLE ") + qtIdent(cbSchema->GetValue()) + wxT(".") + qtIdent(GetName()));
if (connection->BackendMinimumVersion(16, 0) && chkMaterializedView->GetValue())
sql += GetGrant(wxT("arwdRxtm"), wxT("TABLE ") + qtIdent(cbSchema->GetValue()) + wxT(".") + qtIdent(GetName()));
else
sql += GetGrant(wxT("arwdRxt"), wxT("TABLE ") + qtIdent(cbSchema->GetValue()) + wxT(".") + qtIdent(GetName()));
if (connection->BackendMinimumVersion(9, 3) && chkMaterializedView->GetValue())
AppendComment(sql, wxT("MATERIALIZED VIEW ") + qtIdent(cbSchema->GetValue()) + wxT(".") + qtIdent(GetName()), view);

View file

@ -167,7 +167,10 @@ void frmGrantWizard::Go()
wxString privList = wxT("INSERT,SELECT,UPDATE,DELETE,TRUNCATE,REFERENCES,TRIGGER");
const char *privChar = "arwdDxt";
if (conn && conn->BackendMinimumVersion(16, 0)) {
privChar = "arwdDxtm";
privList += ",MAINTAIN";
}
switch (object->GetMetaType())
{
case PGM_DATABASE:
@ -289,7 +292,10 @@ wxString frmGrantWizard::GetSql()
tmp = securityPage->GetGrant(wxT("r"), wxT("TABLE ") + obj->GetQuotedFullIdentifier());
}
else
tmp = securityPage->GetGrant(wxT("arwdDxt"), obj->GetTypeName().Upper() + wxT(" ") + obj->GetQuotedFullIdentifier());
if (conn && conn->BackendMinimumVersion(16, 0))
tmp = securityPage->GetGrant(wxT("arwdDxtm"), obj->GetTypeName().Upper() + wxT(" ") + obj->GetQuotedFullIdentifier());
else
tmp = securityPage->GetGrant(wxT("arwdDxt"), obj->GetTypeName().Upper() + wxT(" ") + obj->GetQuotedFullIdentifier());
break;
}

View file

@ -986,7 +986,7 @@ wxString pgDatabase::GetDefaultPrivileges(const wxChar &cType, wxString strDefPr
{
case 'r':
strType = wxT("TABLES");
strSupportedPrivs = wxT("arwdDxt");
strSupportedPrivs = wxT("arwdDxtm");
break;
case 'S':
strType = wxT("SEQUENCES");

View file

@ -1036,6 +1036,7 @@ wxString pgObject::GetPrivilegeGrant(const wxString &allPattern, const wxString
AppendRight(rights, acl, 'R', wxT("RULE"), column);
AppendRight(rights, acl, 'x', wxT("REFERENCES"), column);
AppendRight(rights, acl, 't', wxT("TRIGGER"), column);
AppendRight(rights, acl, 'm', wxT("MAINTAIN"), column);
AppendRight(rights, acl, 'X', wxT("EXECUTE"), column);
AppendRight(rights, acl, 'U', wxT("USAGE"), column);
AppendRight(rights, acl, 'C', wxT("CREATE"), column);
@ -2076,6 +2077,8 @@ wxString pgObject::GetPrivilegeName(wxChar privilege)
return wxT("REFERENCES");
case 't':
return wxT("TRIGGER");
case 'm':
return wxT("MAINTAIN");
case 'U':
return wxT("USAGE");
case 'X':

View file

@ -719,7 +719,9 @@ wxString pgTable::GetSql(ctlTree *browser)
sql += wxT(";\n")
+ GetOwnerSql(7, 3);
if (GetConnection()->BackendMinimumVersion(8, 4))
if (GetConnection()->BackendMinimumVersion(16, 0))
sql += GetGrant(wxT("arwdDxtm"));
else if (GetConnection()->BackendMinimumVersion(8, 4))
sql += GetGrant(wxT("arwdDxt"));
else if (GetConnection()->BackendMinimumVersion(8, 2))
sql += GetGrant(wxT("arwdxt"));

View file

@ -314,8 +314,9 @@ wxString pgView::GetSql(ctlTree *browser)
+ wxT("\n\n")
+ GetOwnerSql(7, 3, wxT("TABLE ") + GetQuotedFullIdentifier());
}
if (GetConnection()->BackendMinimumVersion(8, 2))
if (GetConnection()->BackendMinimumVersion(16, 0) && IsMatViewFlag)
sql += GetGrant(wxT("arwdxtm"), wxT("TABLE ") + GetQuotedFullIdentifier());
else if (GetConnection()->BackendMinimumVersion(8, 2))
sql += GetGrant(wxT("arwdxt"), wxT("TABLE ") + GetQuotedFullIdentifier());
else
sql += GetGrant(wxT("arwdRxt"), wxT("TABLE ") + GetQuotedFullIdentifier());