Index: pgadmin/include/schema/pgRole.h
===================================================================
--- pgadmin/include/schema/pgRole.h	(révision 7525)
+++ pgadmin/include/schema/pgRole.h	(copie de travail)
@@ -73,6 +73,8 @@
     void iSetSuperuser(const bool b) { superuser=b; }
     bool GetUpdateCatalog() const { return updateCatalog; }
     void iSetUpdateCatalog(const bool b) { updateCatalog=b; }
+    long GetConnectionLimit() const { return connectionLimit; }
+    void iSetConnectionLimit(long newVal) { connectionLimit=newVal; }
     wxArrayString& GetRolesIn() { return rolesIn; }
     wxArrayString& GetConfigList() { return configList; }
 
@@ -94,6 +96,7 @@
     wxString password;
     wxDateTime accountExpires;
     bool superuser, createDatabase, createRole, updateCatalog, inherits, canLogin;
+    long connectionLimit;
     wxArrayString rolesIn;
     wxArrayString configList;
 };
Index: pgadmin/schema/pgRole.cpp
===================================================================
--- pgadmin/schema/pgRole.cpp	(révision 7525)
+++ pgadmin/schema/pgRole.cpp	(copie de travail)
@@ -90,6 +90,8 @@
         else                        sql += wxT(" NOCREATEDB");
         if (GetCreateRole())        sql += wxT(" CREATEROLE");
         else                        sql += wxT(" NOCREATEROLE");
+        if (GetConnectionLimit() > 0)
+                                    sql += wxT(" CONNECTION LIMIT ") + NumToStr(GetConnectionLimit());
         if (GetAccountExpires().IsValid())
         AppendIfFilled(sql, wxT(" VALID UNTIL "), qtDbString(DateToAnsiStr(GetAccountExpires())));
         sql +=wxT(";\n");
@@ -258,6 +260,11 @@
         properties->AppendItem(_("Create roles?"), BoolToYesNo(GetCreateRole()));
         properties->AppendItem(_("Update catalogs?"), BoolToYesNo(GetUpdateCatalog()));
         properties->AppendItem(_("Inherits?"), BoolToYesNo(GetInherits()));
+
+        wxString strConnLimit;
+        strConnLimit.Printf(wxT("%ld"), GetConnectionLimit()); 
+        properties->AppendItem(_("Connection limit"), strConnLimit);
+
         properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
 
         wxString roleList;
@@ -370,6 +377,7 @@
             role->iSetAccountExpires(roles->GetDateTime(wxT("rolvaliduntil")));
             role->iSetPassword(roles->GetVal(wxT("rolpassword")));
             role->iSetComment(roles->GetVal(wxT("description")));
+            role->iSetConnectionLimit(roles->GetLong(wxT("rolconnlimit")));
 
             wxString cfg=roles->GetVal(wxT("rolconfig"));
             if (!cfg.IsEmpty())
Index: pgadmin/dlg/dlgRole.cpp
===================================================================
--- pgadmin/dlg/dlgRole.cpp	(révision 7525)
+++ pgadmin/dlg/dlgRole.cpp	(copie de travail)
@@ -31,6 +31,7 @@
 #define chkCreateDB     CTRL_CHECKBOX("chkCreateDB")
 #define chkCreateRole   CTRL_CHECKBOX("chkCreateRole")
 #define chkUpdateCat    CTRL_CHECKBOX("chkUpdateCat")
+#define txtConnectionLimit CTRL_TEXT("txtConnectionLimit")
 
 #define lbRolesNotIn    CTRL_LISTBOX("lbRolesNotIn")
 #define lbRolesIn       CTRL_LISTBOX("lbRolesIn")
@@ -72,6 +73,7 @@
     EVT_CHECKBOX(XRCID("chkUpdateCat"),             dlgRole::OnChange)
     EVT_CHECKBOX(XRCID("chkSuperuser"),             dlgRole::OnChangeSuperuser)
     EVT_CHECKBOX(XRCID("chkCreateRole"),            dlgRole::OnChange)
+    EVT_TEXT(XRCID("txtConnectionLimit"),           dlgRole::OnChange)
 
     EVT_BUTTON(XRCID("btnAddRole"),                 dlgRole::OnRoleAdd)
     EVT_BUTTON(XRCID("btnDelRole"),                 dlgRole::OnRoleRemove)
@@ -176,6 +178,7 @@
         chkCanLogin->SetValue(role->GetCanLogin());
         datValidUntil->SetValue(role->GetAccountExpires());
         timValidUntil->SetTime(role->GetAccountExpires());
+        txtConnectionLimit->SetValue(NumToStr(role->GetConnectionLimit()));
         txtComment->SetValue(role->GetComment());
 
         size_t index;
@@ -203,6 +206,7 @@
             btnDelRole->Disable();
             cbVarname->Disable();
             txtValue->Disable();
+            txtConnectionLimit->Disable();
             btnAdd->Disable();
             btnRemove->Disable();
         }
@@ -540,6 +544,21 @@
                 options += wxT("\n   VALID UNTIL 'infinity'");
         }
 
+        if (txtConnectionLimit->GetValue().Length() == 0)
+        {
+            if (role->GetConnectionLimit() != -1)
+            {
+                options += wxT(" CONNECTION LIMIT -1");
+            }
+        }
+        else
+        {
+            if (txtConnectionLimit->GetValue() != NumToStr(role->GetConnectionLimit()))
+            {
+                options += wxT(" CONNECTION LIMIT ") + txtConnectionLimit->GetValue();
+            }
+        }
+
         if (!options.IsNull())
             sql += wxT("ALTER Role ") + qtIdent(name) + options + wxT(";\n");
 
@@ -639,6 +658,11 @@
         else
             sql += wxT("\n   VALID UNTIL 'infinity'");
         
+        if (txtConnectionLimit->GetValue().Length() > 0)
+        {
+            sql += wxT(" CONNECTION LIMIT ") + txtConnectionLimit->GetValue();
+        }
+
         int cnt = lbRolesIn->GetCount();
 		wxString grants;
 
Index: pgadmin/ui/dlgRole.xrc
===================================================================
--- pgadmin/ui/dlgRole.xrc	(révision 7525)
+++ pgadmin/ui/dlgRole.xrc	(copie de travail)
@@ -2,7 +2,7 @@
 <resource>
   <object class="wxDialog" name="dlgRole">
     <title></title>
-    <size>268,240d</size>
+    <size>268,260d</size>
     <style>wxDEFAULT_DIALOG_STYLE|wxCAPTION|wxSYSTEM_MENU|wxRESIZE_BORDER|wxRESIZE_BOX|wxTHICK_FRAME</style>
     <object class="wxFlexGridSizer">
       <cols>1</cols>
@@ -10,17 +10,17 @@
       <growablecols>0</growablecols>
       <object class="sizeritem">
         <object class="wxNotebook" name="nbNotebook">
-          <size>264,215d</size>
+          <size>264,235d</size>
           <selected>0</selected>
           <object class="notebookpage">
             <label>Properties</label>
             <object class="wxPanel" name="pnlProperties">
               <object class="wxFlexGridSizer">
                 <cols>2</cols>
-                <rows>8</rows>
+                <rows>9</rows>
                 <vgap>5</vgap>
                 <hgap>5</hgap>
-                <growablerows>6</growablerows>
+                <growablerows>7</growablerows>
                 <growablecols>1</growablecols>
                 <object class="sizeritem">
                   <object class="wxStaticText" name="stName">
@@ -123,6 +123,19 @@
                   <border>4</border>
                 </object>
                 <object class="sizeritem">
+                  <object class="wxStaticText" name="stConnectionLimit">
+                    <label>Connection Limit</label>
+                  </object>
+                  <flag>wxALIGN_CENTRE_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxTextCtrl" name="txtConnectionLimit">
+                  </object>
+                  <flag>wxEXPAND|wxALIGN_CENTRE_VERTICAL|wxALL</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
                   <object class="wxStaticText" name="stComment">
                     <label>Comment</label>
                   </object>
