diff --git a/ctl/ctlDefaultSecurityPanel.cpp b/ctl/ctlDefaultSecurityPanel.cpp index 71a71e1..ffa7b1b 100644 --- a/ctl/ctlDefaultSecurityPanel.cpp +++ b/ctl/ctlDefaultSecurityPanel.cpp @@ -26,7 +26,7 @@ #include -defaultPrivilegesOn g_defPrivTables('r', wxT("Tables"), wxT("arwdDxt")), +defaultPrivilegesOn g_defPrivTables17('r', wxT("Tables"), wxT("arwdDxtm")), g_defPrivTables('r', wxT("Tables"), wxT("arwdDxt")), g_defPrivSequences('S', wxT("Sequences"), wxT("rwU")), g_defPrivFunctions('f', wxT("Functions"), wxT("X")), g_defPrivTypes('T', wxT("Types"), wxT("U")); @@ -44,8 +44,10 @@ ctlDefaultSecurityPanel::ctlDefaultSecurityPanel(pgConn *conn, wxNotebook *nb, w mainSizer->AddGrowableRow(0); nbNotebook = new wxNotebook(this, -1, wxDefaultPosition, wxDefaultSize, 0, _("Default ACLs")); - - m_defPrivOnTablesPanel = new ctlDefaultPrivilegesPanel(this, nbNotebook, g_defPrivTables, imgList); + if (conn->BackendMinimumVersion(17, 0)) + m_defPrivOnTablesPanel = new ctlDefaultPrivilegesPanel(this, nbNotebook, g_defPrivTables17, imgList); + else + m_defPrivOnTablesPanel = new ctlDefaultPrivilegesPanel(this, nbNotebook, g_defPrivTables, imgList); m_defPrivOnSeqsPanel = new ctlDefaultPrivilegesPanel(this, nbNotebook, g_defPrivSequences, imgList); m_defPrivOnFuncsPanel = new ctlDefaultPrivilegesPanel(this, nbNotebook, g_defPrivFunctions, imgList); if (conn->BackendMinimumVersion(9, 2)) diff --git a/ctl/ctlSecurityPanel.cpp b/ctl/ctlSecurityPanel.cpp index cc79af0..e2cac8a 100644 --- a/ctl/ctlSecurityPanel.cpp +++ b/ctl/ctlSecurityPanel.cpp @@ -43,6 +43,7 @@ BEGIN_EVENT_TABLE(ctlSecurityPanel, wxPanel) EVT_CHECKBOX(CTL_PRIVCB + 12, ctlSecurityPanel::OnPrivCheck) EVT_CHECKBOX(CTL_PRIVCB + 14, ctlSecurityPanel::OnPrivCheck) EVT_CHECKBOX(CTL_PRIVCB + 16, ctlSecurityPanel::OnPrivCheck) + EVT_CHECKBOX(CTL_PRIVCB + 18, ctlSecurityPanel::OnPrivCheck) //MAINTAIN END_EVENT_TABLE(); DEFINE_LOCAL_EVENT_TYPE(EVT_SECURITYPANEL_CHANGE) @@ -160,6 +161,11 @@ void ctlSecurityPanel::SetConnection(pgConn *conn) connection = conn; if (connection && stGroup && connection->BackendMinimumVersion(8, 1)) stGroup->SetLabel(_("Role")); + if (connection && !connection->BackendMinimumVersion(17, 0)) + { + DisablePrivilege("MAINTAIN"); + ; + } } wxString ctlSecurityPanel::GetUserPrivileges() diff --git a/dlg/dlgTable.cpp b/dlg/dlgTable.cpp index c02e9c9..8f152e9 100644 --- a/dlg/dlgTable.cpp +++ b/dlg/dlgTable.cpp @@ -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(17, 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); diff --git a/dlg/dlgView.cpp b/dlg/dlgView.cpp index 6d1664a..69c78cd 100644 --- a/dlg/dlgView.cpp +++ b/dlg/dlgView.cpp @@ -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(17, 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); diff --git a/frm/frmGrantWizard.cpp b/frm/frmGrantWizard.cpp index f4d70fa..8556ccb 100644 --- a/frm/frmGrantWizard.cpp +++ b/frm/frmGrantWizard.cpp @@ -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(17, 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(17, 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; } diff --git a/schema/pgDatabase.cpp b/schema/pgDatabase.cpp index bb0e674..b54897c 100644 --- a/schema/pgDatabase.cpp +++ b/schema/pgDatabase.cpp @@ -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"); diff --git a/schema/pgObject.cpp b/schema/pgObject.cpp index 0407609..f6c7bf7 100644 --- a/schema/pgObject.cpp +++ b/schema/pgObject.cpp @@ -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); @@ -2104,6 +2105,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': diff --git a/schema/pgTable.cpp b/schema/pgTable.cpp index 6574ae7..06d1877 100644 --- a/schema/pgTable.cpp +++ b/schema/pgTable.cpp @@ -720,7 +720,9 @@ wxString pgTable::GetSql(ctlTree *browser) sql += wxT(";\n") + GetOwnerSql(7, 3); - if (GetConnection()->BackendMinimumVersion(8, 4)) + if (GetConnection()->BackendMinimumVersion(17, 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")); diff --git a/schema/pgView.cpp b/schema/pgView.cpp index b307519..a68e7eb 100644 --- a/schema/pgView.cpp +++ b/schema/pgView.cpp @@ -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(17, 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());