Browse files

Report default privileges

Default privileges weren't display in the Schema properties dialog.

Per a report from Nathan Alden.
  • Loading branch information...
1 parent b024f39 commit 53b6a09ac59e646b4c772ead3c42ab65dcc84929 @gleu gleu committed Dec 24, 2012
Showing with 29 additions and 2 deletions.
  1. +1 −0 CHANGELOG
  2. +3 −2 pgadmin/ctl/ctlDefaultSecurityPanel.cpp
  3. +14 −0 pgadmin/dlg/dlgProperty.cpp
  4. +11 −0 pgadmin/schema/pgSchema.cpp
View
1 CHANGELOG
@@ -37,6 +37,7 @@ Changes
Date Dev Ver Change details
---------- --- ------ --------------
+2012-12-24 GL 1.16.2 Display default privs. Report from Nathan Alden.
2012-12-24 GL 1.16.2 Sort references by schema name and relation name in
dlgForeignKey. Report from Michal Kozusznik.
2012-12-24 GL 1.16.2 Fix the change of the superuser attribute. Report from
View
5 pgadmin/ctl/ctlDefaultSecurityPanel.cpp
@@ -530,15 +530,16 @@ void ctlDefaultPrivilegesPanel::Update(wxString strDefPrivs)
{
unsigned int index = 0;
- cbGroups->Clear();
lbPrivileges->DeleteAllItems();
m_privileges.clear();
+ cbGroups->Clear();
cbGroups->Append(wxT("public"));
-
for (; index < m_defSecurityPanel->m_groups.GetCount(); index++)
+ {
cbGroups->Append(m_defSecurityPanel->m_groups[index]);
+ }
if (!strDefPrivs.IsEmpty())
{
View
14 pgadmin/dlg/dlgProperty.cpp
@@ -2103,6 +2103,20 @@ int dlgDefaultSecurityProperty::Go(bool modal, bool createDefPrivs, const wxStri
const wxString &defPrivsOnSeqs, const wxString &defPrivsOnFuncs,
const wxString &defPrivsOnTypes)
{
+ if (securityPage)
+ {
+ if (cbOwner && !cbOwner->GetCount())
+ {
+ if (!GetObject())
+ cbOwner->Append(wxEmptyString);
+ AddGroups(cbOwner);
+ AddUsers(cbOwner);
+ }
+
+ securityPage->SetConnection(connection);
+ //securityPage->Layout();
+ }
+
int res = dlgSecurityProperty::Go(modal);
if (defaultSecurityPage)
View
11 pgadmin/schema/pgSchema.cpp
@@ -394,6 +394,17 @@ void pgSchemaBase::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *
}
else
browser->AppendCollection(this, catalogObjectFactory);
+
+ if (GetConnection()->BackendMinimumVersion(9, 0))
+ {
+ m_defPrivsOnTables = GetConnection()->ExecuteScalar(wxT("SELECT defaclacl FROM pg_catalog.pg_default_acl dacl WHERE dacl.defaclnamespace = ") + GetOidStr() + wxT(" AND defaclobjtype='r'"));
+ m_defPrivsOnSeqs = GetConnection()->ExecuteScalar(wxT("SELECT defaclacl FROM pg_catalog.pg_default_acl dacl WHERE dacl.defaclnamespace = ") + GetOidStr() + wxT(" AND defaclobjtype='S'"));
+ m_defPrivsOnFuncs = GetConnection()->ExecuteScalar(wxT("SELECT defaclacl FROM pg_catalog.pg_default_acl dacl WHERE dacl.defaclnamespace = ") + GetOidStr() + wxT(" AND defaclobjtype='f'"));
+ }
+ if (GetConnection()->BackendMinimumVersion(9, 2))
+ {
+ m_defPrivsOnTypes = GetConnection()->ExecuteScalar(wxT("SELECT defaclacl FROM pg_catalog.pg_default_acl dacl WHERE dacl.defaclnamespace = ") + GetOidStr() + wxT(" AND defaclobjtype='T'"));
+ }
}

0 comments on commit 53b6a09

Please sign in to comment.