Le 04/04/2010 22:35, Erwin Brandstetter a écrit :
> On 04.04.2010 22:10, [email protected] wrote:
>> Le 04/04/2010 21:39, Erwin Brandstetter a écrit :
>>   
>>> Hi developers!
>>>
>>> Seeing as Guillaume is on a roll, fixing bugs faster than I can open new
>>> tickets, I have found one more, in a feeble attempt to keep up.
>>>      
>> Thanks :)
>>
>>   
>>> Group roles are missing for the "Owner" field of properties dialogs.
>>>      
>> You probably forgot the "Show users for privileges" preference in the
>> Options dialog.
>>    
> 
> Nope, I don't think we will get away that easily. :p
> I had that option checked, and it works the other way round, too: user
> (login) roles are added to the drop-down "Role", "Privileges" tab.
> The new bug concerns missing group (non-login) roles in the "Owner"
> field, "Properties"-tab.
> 

You're definitely right. Next time, I'll read more carefully your bug
report :/

Anyways, here is a patch to fix this. Do we need an option to
enable/disable this behaviour? I think not, but, as we have one for
priviledges, prefer to ask first before commiting it.


-- 
Guillaume.
 http://www.postgresqlfr.org
 http://dalibo.com
Index: pgadmin/include/dlg/dlgProperty.h
===================================================================
--- pgadmin/include/dlg/dlgProperty.h	(révision 8252)
+++ pgadmin/include/dlg/dlgProperty.h	(copie de travail)
@@ -112,6 +112,7 @@
     void OnChangeReadOnly(wxCommandEvent& event);
 
 protected:
+    void AddGroups(ctlComboBoxFix *comboBox=0);
     void AddUsers(ctlComboBoxFix *cb1, ctlComboBoxFix *cb2=0);
     void FillCombobox(const wxString &query, ctlComboBoxFix *cb1, ctlComboBoxFix *cb2=0);
     void PrepareTablespace(ctlComboBoxFix *cb, const OID current=0);
Index: pgadmin/dlg/dlgExtTable.cpp
===================================================================
--- pgadmin/dlg/dlgExtTable.cpp	(révision 8252)
+++ pgadmin/dlg/dlgExtTable.cpp	(copie de travail)
@@ -59,7 +59,7 @@
 {
     int returncode;
     
-    AddGroups();
+    AddGroups(cbOwner);
     AddUsers(cbOwner);
 
     if (extTable)
Index: pgadmin/dlg/dlgLanguage.cpp
===================================================================
--- pgadmin/dlg/dlgLanguage.cpp	(révision 8252)
+++ pgadmin/dlg/dlgLanguage.cpp	(copie de travail)
@@ -60,7 +60,7 @@
     if (!connection->BackendMinimumVersion(7, 5))
         txtComment->Disable();
 
-    AddGroups();
+    AddGroups(cbOwner);
     AddUsers(cbOwner);
     if (!connection->BackendMinimumVersion(8, 3))
         cbOwner->Disable();
Index: pgadmin/dlg/dlgProperty.cpp
===================================================================
--- pgadmin/dlg/dlgProperty.cpp	(révision 8252)
+++ pgadmin/dlg/dlgProperty.cpp	(copie de travail)
@@ -306,6 +306,7 @@
     {
         if (!GetObject())
             cbOwner->Append(wxEmptyString);
+        AddGroups(cbowner);
         AddUsers(cbowner);
     }
     if (txtOid)
@@ -546,6 +547,19 @@
 }
 
 
+void dlgProperty::AddGroups(ctlComboBoxFix *combo)
+{
+    if (connection->BackendMinimumVersion(8, 1))
+    {
+        FillCombobox(wxT("SELECT rolname FROM pg_roles WHERE NOT rolcanlogin ORDER BY 1"), combo);
+    }
+    else
+    {
+        FillCombobox(wxT("SELECT groname FROM pg_group ORDER BY 1"), combo);
+    }
+}
+
+
 void dlgProperty::PrepareTablespace(ctlComboBoxFix *cb, const OID current)
 {
     wxASSERT(cb != 0);
Index: pgadmin/dlg/dlgFunction.cpp
===================================================================
--- pgadmin/dlg/dlgFunction.cpp	(révision 8252)
+++ pgadmin/dlg/dlgFunction.cpp	(copie de travail)
@@ -177,7 +177,7 @@
     if (!isBackendMinVer84)
         txtArgDefVal->Disable();
 
-    AddGroups();
+    AddGroups(cbOwner);
     AddUsers(cbOwner);
 
     lstArguments->AddColumn(_("Type"), 60);
Index: pgadmin/dlg/dlgTable.cpp
===================================================================
--- pgadmin/dlg/dlgTable.cpp	(révision 8252)
+++ pgadmin/dlg/dlgTable.cpp	(copie de travail)
@@ -205,7 +205,7 @@
 {
     if (!table)
         cbOwner->Append(wxT(""));
-    AddGroups();
+    AddGroups(cbOwner);
     AddUsers(cbOwner);
     PrepareTablespace(cbTablespace);
     PopulateDatatypeCache();
Index: pgadmin/dlg/dlgPackage.cpp
===================================================================
--- pgadmin/dlg/dlgPackage.cpp	(révision 8252)
+++ pgadmin/dlg/dlgPackage.cpp	(copie de travail)
@@ -65,7 +65,7 @@
 
     cbOwner->Disable();
 
-    AddGroups();
+    AddGroups(cbOwner);
     AddUsers(cbOwner);
 
     if (package)
Index: pgadmin/dlg/dlgTablespace.cpp
===================================================================
--- pgadmin/dlg/dlgTablespace.cpp	(révision 8252)
+++ pgadmin/dlg/dlgTablespace.cpp	(copie de travail)
@@ -77,7 +77,7 @@
 {
     if (!tablespace)
         cbOwner->Append(wxEmptyString);
-    AddGroups();
+    AddGroups(cbOwner);
     AddUsers(cbOwner);
 
     pgSet *set;
Index: pgadmin/dlg/dlgDatabase.cpp
===================================================================
--- pgadmin/dlg/dlgDatabase.cpp	(révision 8252)
+++ pgadmin/dlg/dlgDatabase.cpp	(copie de travail)
@@ -107,7 +107,7 @@
     if (!database)
         cbOwner->Append(wxT(""));
 
-    AddGroups();
+    AddGroups(cbOwner);
     AddUsers(cbOwner);
 
     if (connection->BackendMinimumVersion(8,5))
Index: pgadmin/dlg/dlgSequence.cpp
===================================================================
--- pgadmin/dlg/dlgSequence.cpp	(révision 8252)
+++ pgadmin/dlg/dlgSequence.cpp	(copie de travail)
@@ -66,7 +66,7 @@
 {
     if (!sequence)
         cbOwner->Append(wxEmptyString);
-    AddGroups();
+    AddGroups(cbOwner);
     AddUsers(cbOwner);
 
     if (sequence)
Index: pgadmin/dlg/dlgView.cpp
===================================================================
--- pgadmin/dlg/dlgView.cpp	(révision 8252)
+++ pgadmin/dlg/dlgView.cpp	(copie de travail)
@@ -56,7 +56,7 @@
 
 int dlgView::Go(bool modal)
 {
-    AddGroups();
+    AddGroups(cbOwner);
     AddUsers(cbOwner);
 
     if (view)
Index: pgadmin/dlg/dlgSchema.cpp
===================================================================
--- pgadmin/dlg/dlgSchema.cpp	(révision 8252)
+++ pgadmin/dlg/dlgSchema.cpp	(copie de travail)
@@ -47,7 +47,7 @@
     if (!schema)
         cbOwner->Append(wxT(""));
 
-    AddGroups();
+    AddGroups(cbOwner);
     AddUsers(cbOwner);
     if (schema)
     {
-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Reply via email to