diff --git a/pgadmin/ctl/module.mk b/pgadmin/ctl/module.mk
index 4e8246f..957014a 100644
--- a/pgadmin/ctl/module.mk
+++ b/pgadmin/ctl/module.mk
@@ -19,6 +19,7 @@ pgadmin3_SOURCES += \
         $(srcdir)/ctl/ctlSQLBox.cpp \
         $(srcdir)/ctl/ctlSQLGrid.cpp \
         $(srcdir)/ctl/ctlSQLResult.cpp \
+        $(srcdir)/ctl/ctlDefaultSecurityPanel.cpp \
         $(srcdir)/ctl/ctlSecurityPanel.cpp \
         $(srcdir)/ctl/ctlTree.cpp \
         $(srcdir)/ctl/explainCanvas.cpp \
diff --git a/pgadmin/dlg/dlgDatabase.cpp b/pgadmin/dlg/dlgDatabase.cpp
index f305643..d6c310e 100644
--- a/pgadmin/dlg/dlgDatabase.cpp
+++ b/pgadmin/dlg/dlgDatabase.cpp
@@ -53,7 +53,7 @@ dlgProperty *pgDatabaseFactory::CreateDialog(frmMain *frame, pgObject *node, pgO
 }
 
 
-BEGIN_EVENT_TABLE(dlgDatabase, dlgSecurityProperty)
+BEGIN_EVENT_TABLE(dlgDatabase, dlgDefaultSecurityProperty)
     EVT_TEXT(XRCID("txtPath"),                      dlgProperty::OnChange)
     EVT_TEXT(XRCID("cbTablespace"),                 dlgProperty::OnChange)
     EVT_COMBOBOX(XRCID("cbTablespace"),             dlgProperty::OnChange)
@@ -77,7 +77,7 @@ END_EVENT_TABLE();
 
 
 dlgDatabase::dlgDatabase(pgaFactory *f, frmMain *frame, pgDatabase *node)
-: dlgSecurityProperty(f, frame, node, wxT("dlgDatabase"), wxT("CREATE,TEMP,CONNECT"), "CTc")
+: dlgDefaultSecurityProperty(f, frame, node, wxT("dlgDatabase"), wxT("CREATE,TEMP,CONNECT"), "CTc")
 {
     database=node;
     schemaRestrictionOk=true;
diff --git a/pgadmin/dlg/dlgProperty.cpp b/pgadmin/dlg/dlgProperty.cpp
index 80caec3..7ba3fe2 100644
--- a/pgadmin/dlg/dlgProperty.cpp
+++ b/pgadmin/dlg/dlgProperty.cpp
@@ -1721,6 +1721,227 @@ bool dlgSecurityProperty::DisablePrivilege(const wxString &priv)
 /////////////////////////////////////////////////////////////////////////////
 
 
+BEGIN_EVENT_TABLE(dlgDefaultSecurityProperty, dlgProperty)
+    EVT_BUTTON(CTL_ADDPRIV,             dlgDefaultSecurityProperty::OnAddPriv)
+    EVT_BUTTON(CTL_DELPRIV,             dlgDefaultSecurityProperty::OnDelPriv)
+#ifdef __WXMAC__
+    EVT_SIZE(                           dlgDefaultSecurityProperty::OnChangeSize)
+#endif
+END_EVENT_TABLE();
+
+
+dlgDefaultSecurityProperty::dlgDefaultSecurityProperty(pgaFactory *f, frmMain *frame, pgObject *obj, const wxString &resName, const wxString& privList, const char *privChar)
+        : dlgSecurityProperty(f, frame, obj, resName, privList, privChar)
+{
+    securityChanged=false;
+
+
+    if (!privList.IsEmpty() && (!obj || obj->CanCreate()))
+    {
+        defaultSecurityPage = new ctlDefaultSecurityPanel(nbNotebook, privList, privChar, frame->GetImageList());
+
+        if (obj)
+        {
+
+            wxArrayString groups;
+            // Fetch Groups Information
+            pgSet *setGrp = obj->GetConnection()->ExecuteSet(wxT("SELECT groname FROM pg_group ORDER BY groname"));
+
+            if (setGrp)
+            {
+                while (!setGrp->Eof())
+                {
+                    groups.Add(setGrp->GetVal(0));
+                    setGrp->MoveNext();
+                }
+                delete setGrp;
+            }
+        
+            wxString str=obj->GetAcl();
+            if (!str.IsEmpty())
+            {
+                str = str.Mid(1, str.Length()-2);
+                wxStringTokenizer tokens(str, wxT(","));
+
+                while (tokens.HasMoreTokens())
+                {
+                    wxString str=tokens.GetNextToken();
+                    if (str[0U]== '"')
+                        str = str.Mid(1, str.Length()-2);
+
+                    wxString name=str.BeforeLast('=');
+                    wxString value;
+
+                    connection = obj->GetConnection();
+                    if (connection->BackendMinimumVersion(7, 4))
+                        value=str.Mid(name.Length()+1).BeforeLast('/');
+                    else
+                        value=str.Mid(name.Length()+1);
+
+                    int icon=userFactory.GetIconId();
+
+                    if (name.Left(6).IsSameAs(wxT("group "), false))
+                    {
+                        icon = groupFactory.GetIconId();
+                        name = wxT("group ") + qtStrip(name.Mid(6));
+                    }
+                    else if (name.IsEmpty())
+                    {
+                        icon = PGICON_PUBLIC;
+                        name=wxT("public");
+                    }
+                    else
+                    {
+                        name = qtStrip(name);
+                        for (unsigned int index=0; index < groups.Count(); index++)
+                            if (name == groups[index])
+                            {
+                                name = wxT("group ") + name;
+                                icon = groupFactory.GetIconId();
+                                break;
+                            }
+                    }
+
+                    defaultSecurityPage->lbPrivileges->AppendItem(icon, name, value);
+                    currentAcl.Add(name + wxT("=") + value);
+                }
+            }
+        }
+    }
+    else
+        defaultSecurityPage = NULL;
+}
+
+
+dlgDefaultSecurityProperty::~dlgDefaultSecurityProperty()
+{
+}
+
+
+
+#ifdef __WXMAC__
+void dlgDefaultSecurityProperty::OnChangeSize(wxSizeEvent &ev)
+{
+    defaultSecurityPage->lbPrivileges->SetSize(wxDefaultCoord, wxDefaultCoord,
+        ev.GetSize().GetWidth(), ev.GetSize().GetHeight() - 550);
+    if (GetAutoLayout())
+    {
+        Layout();
+    }
+}
+#endif
+
+
+int dlgDefaultSecurityProperty::Go(bool modal)
+{
+    if (defaultSecurityPage)
+    {
+        defaultSecurityPage->SetConnection(connection);
+        //defaultSecurityPage->Layout();
+    }
+    
+    return dlgSecurityProperty::Go(modal);
+}
+
+
+void dlgDefaultSecurityProperty::AddGroups(ctlComboBox *comboBox)
+{
+    if (!((defaultSecurityPage && defaultSecurityPage->cbGroups) || comboBox))
+        return;
+
+    pgSet *set=connection->ExecuteSet(wxT("SELECT groname FROM pg_group ORDER BY groname"));
+
+    if (set)
+    {
+        while (!set->Eof())
+        {
+            if (defaultSecurityPage && defaultSecurityPage->cbGroups)
+                defaultSecurityPage->cbGroups->Append(wxT("group ") + set->GetVal(0));
+            if (comboBox)
+                comboBox->Append(set->GetVal(0));
+            set->MoveNext();
+        }
+        delete set;
+    }
+}
+
+
+void dlgDefaultSecurityProperty::AddUsers(ctlComboBox *combobox)
+{
+    if (defaultSecurityPage && defaultSecurityPage->cbGroups && settings->GetShowUsersForPrivileges())
+    {
+        defaultSecurityPage->stGroup->SetLabel(_("Group/User"));
+        dlgProperty::AddUsers(defaultSecurityPage->cbGroups, combobox);
+    }
+    else
+        dlgProperty::AddUsers(combobox);
+}
+
+
+void dlgDefaultSecurityProperty::OnAddPriv(wxCommandEvent &ev)
+{
+    securityChanged=true;
+    EnableOK(btnOK->IsEnabled());
+}
+
+
+void dlgDefaultSecurityProperty::OnDelPriv(wxCommandEvent &ev)
+{
+    securityChanged=true;
+    EnableOK(btnOK->IsEnabled());
+}
+
+
+wxString dlgDefaultSecurityProperty::GetHelpPage() const
+{
+    if (nbNotebook->GetSelection() == (int)nbNotebook->GetPageCount()-2)
+        return wxT("pg/sql-grant");
+    else
+        return dlgProperty::GetHelpPage();
+}
+
+
+void dlgDefaultSecurityProperty::EnableOK(bool enable)
+{
+    // Don't enable the OK button if the object isn't yet created,
+    // leave that to the object dialog.
+    if (securityChanged && GetObject())
+    {
+        wxString sql=GetSql();
+        if (sql.IsEmpty())
+        {
+            enable=false;
+            securityChanged=false;
+        }
+        else
+            enable=true;
+    }
+    dlgProperty::EnableOK(enable);
+}
+
+
+
+
+wxString dlgDefaultSecurityProperty::GetGrant(const wxString &allPattern, const wxString &grantObject)
+{
+    if (defaultSecurityPage)
+        return defaultSecurityPage->GetGrant(allPattern, grantObject, &currentAcl);
+    else
+    return wxString();
+}
+
+bool dlgDefaultSecurityProperty::DisablePrivilege(const wxString &priv) 
+{ 
+    if (defaultSecurityPage) 
+        return defaultSecurityPage->DisablePrivilege(priv); 
+    else 
+        return true; 
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+
 BEGIN_EVENT_TABLE(dlgAgentProperty, dlgProperty)
     EVT_BUTTON (wxID_OK,                            dlgAgentProperty::OnOK)
 END_EVENT_TABLE();
diff --git a/pgadmin/include/ctl/module.mk b/pgadmin/include/ctl/module.mk
index 7ab23f8..3059a73 100644
--- a/pgadmin/include/ctl/module.mk
+++ b/pgadmin/include/ctl/module.mk
@@ -16,6 +16,7 @@ pgadmin3_SOURCES += \
 	$(srcdir)/include/ctl/ctlComboBox.h \
 	$(srcdir)/include/ctl/ctlListView.h \
 	$(srcdir)/include/ctl/ctlMenuToolbar.h \
+	$(srcdir)/include/ctl/ctlDefaultSecurityPanel.h \
 	$(srcdir)/include/ctl/ctlSecurityPanel.h \
 	$(srcdir)/include/ctl/ctlSQLBox.h \
 	$(srcdir)/include/ctl/ctlSQLGrid.h \
diff --git a/pgadmin/include/dlg/dlgDatabase.h b/pgadmin/include/dlg/dlgDatabase.h
index 51da793..7437294 100644
--- a/pgadmin/include/dlg/dlgDatabase.h
+++ b/pgadmin/include/dlg/dlgDatabase.h
@@ -17,7 +17,7 @@
 
 class pgDatabase;
 
-class dlgDatabase : public dlgSecurityProperty
+class dlgDatabase : public dlgDefaultSecurityProperty
 {
 public:
     dlgDatabase(pgaFactory *factory, frmMain *frame, pgDatabase *db);
diff --git a/pgadmin/include/dlg/dlgProperty.h b/pgadmin/include/dlg/dlgProperty.h
index efb4a13..aa7d37d 100644
--- a/pgadmin/include/dlg/dlgProperty.h
+++ b/pgadmin/include/dlg/dlgProperty.h
@@ -18,6 +18,7 @@
 #include <wx/dynarray.h>
 #include "schema/pgObject.h"
 #include "db/pgConn.h"
+#include "ctl/ctlDefaultSecurityPanel.h"
 #include "ctl/ctlSecurityPanel.h"
 
 class pgSchema;
@@ -225,6 +226,39 @@ private:
 
 
 
+class dlgDefaultSecurityProperty : public dlgSecurityProperty
+{
+protected:
+    dlgDefaultSecurityProperty(pgaFactory *factory, frmMain *frame, pgObject *obj, const wxString &resName, const wxString& privilegeList, const char *privilegeChar);
+    ~dlgDefaultSecurityProperty();
+    void AddGroups(ctlComboBox *comboBox=0);
+    void AddUsers(ctlComboBox *comboBox=0);
+
+    wxString GetGrant(const wxString &allPattern, const wxString &grantObject);
+    void EnableOK(bool enable);
+    virtual wxString GetHelpPage() const;
+    virtual int Go(bool modal=false);
+    bool DisablePrivilege(const wxString &priv);
+    void SetPrivilegesLayout();
+
+#ifdef __WXMAC__
+    void OnChangeSize(wxSizeEvent &ev);
+#endif
+
+private:
+
+    void OnAddPriv(wxCommandEvent& ev);
+    void OnDelPriv(wxCommandEvent& ev);
+    bool securityChanged;
+
+    ctlDefaultSecurityPanel *defaultSecurityPage;
+    wxArrayString currentAcl;
+
+    DECLARE_EVENT_TABLE()
+};
+
+
+
 class dlgAgentProperty : public dlgProperty
 {
 public:
