Log Message:
-----------
acl fix for escaped user/group names

Modified Files:
--------------
    pgadmin3/src/utils:
        misc.cpp (r1.52 -> r1.53)
    pgadmin3/src/ui:
        dlgProperty.cpp (r1.89 -> r1.90)
    pgadmin3/src/include:
        misc.h (r1.42 -> r1.43)

Index: misc.cpp
===================================================================
RCS file: /projects/pgadmin3/src/utils/misc.cpp,v
retrieving revision 1.52
retrieving revision 1.53
diff -Lsrc/utils/misc.cpp -Lsrc/utils/misc.cpp -u -w -r1.52 -r1.53
--- src/utils/misc.cpp
+++ src/utils/misc.cpp
@@ -288,6 +288,15 @@
 }
 
 
+wxString qtStrip(const wxString &str)
+{
+    if (str.Left(2) == wxT("\\\""))
+        return str.Mid(2, str.Length()-4);
+    else
+        return str;
+}
+
+
 void FillArray(wxArrayString &array, const wxString &list)
 {
     const wxChar *cp=list.c_str();
Index: dlgProperty.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/dlgProperty.cpp,v
retrieving revision 1.89
retrieving revision 1.90
diff -Lsrc/ui/dlgProperty.cpp -Lsrc/ui/dlgProperty.cpp -u -w -r1.89 -r1.90
--- src/ui/dlgProperty.cpp
+++ src/ui/dlgProperty.cpp
@@ -1090,7 +1090,6 @@
 END_EVENT_TABLE();
 
 
-
 dlgSecurityProperty::dlgSecurityProperty(frmMain *frame, pgObject *obj, const 
wxString &resName, const wxString& privList, char *privChar)
         : dlgProperty(frame, resName)
 {
@@ -1129,13 +1128,15 @@
                     if (name.Left(6).IsSameAs(wxT("group "), false))
                     {
                         icon = PGICON_GROUP;
-                        name = wxT("group ") + name.Mid(6);
+                        name = wxT("group ") + qtStrip(name.Mid(6));
                     }
                     else if (name.IsEmpty())
                     {
                         icon = PGICON_PUBLIC;
                         name=wxT("public");
                     }
+                    else
+                        name = qtStrip(name);
 
                     securityPage->lbPrivileges->AppendItem(icon, name, value);
                     currentAcl.Add(name + wxT("=") + value);
Index: misc.h
===================================================================
RCS file: /projects/pgadmin3/src/include/misc.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -Lsrc/include/misc.h -Lsrc/include/misc.h -u -w -r1.42 -r1.43
--- src/include/misc.h
+++ src/include/misc.h
@@ -92,9 +92,10 @@
 wxString DateToStr(const wxDateTime &datetime);
 
 // Quoting
-wxString qtString(const wxString& value);
-wxString qtIdent(const wxString& value);
+wxString qtString(const wxString& value);   // add ' and escape if necessary
+wxString qtIdent(const wxString& value);    // add " if necessary
 wxString qtStringDollar(const wxString &value);
+wxString qtStrip(const wxString& value);    // remove \"
 
 // check if size/pos have reasonable values
 void CheckOnScreen(wxPoint &pos, wxSize &size, const int w0=100, const int h0=70);
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to