mirror of
https://github.com/levinsv/pgadmin3.git
synced 2026-05-15 06:05:49 -06:00
Add view MAINTAIN privilege
Добавлена поддержка отображения новой привелегии MAINTAIN.
This commit is contained in:
parent
3bad8c07f3
commit
38f4510342
9 changed files with 37 additions and 13 deletions
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include <wx/arrimpl.cpp>
|
||||
|
||||
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))
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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':
|
||||
|
|
|
|||
|
|
@ -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"));
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue