[mapguide-commits] r7015 - in branches/maestro-4.0.x: Maestro Maestro.Editors/FeatureSource/Providers/Rdbms

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Sep 13 10:13:18 PDT 2012


Author: jng
Date: 2012-09-13 10:13:18 -0700 (Thu, 13 Sep 2012)
New Revision: 7015

Modified:
   branches/maestro-4.0.x/Maestro.Editors/FeatureSource/Providers/Rdbms/RdbmsBaseCtrl.cs
   branches/maestro-4.0.x/Maestro/changelog.txt
Log:
#2113: When opening a RDBMS feature source, fill in a fake password to give the appearance of one already being filled in. It is not possible from a security standpoint to request decrypted Feature Source passwords.

Modified: branches/maestro-4.0.x/Maestro/changelog.txt
===================================================================
--- branches/maestro-4.0.x/Maestro/changelog.txt	2012-09-13 17:05:53 UTC (rev 7014)
+++ branches/maestro-4.0.x/Maestro/changelog.txt	2012-09-13 17:13:18 UTC (rev 7015)
@@ -1,9 +1,14 @@
 4.0.3
 -----
  - Use UNIQUE() for fetching distinct values in Expression Editor
+ - Fusion editor fixes
+   - OSM support
+ - Fix: Have RDBMS Feature Source editor fill a fake password when opening a RDBMS feature source with secured credentials to give appearance of a password filled in.
  - Fix: Duplicating vector scale ranges not creating true clones
  - Fix: Prevent Map Definition groups from being dragged and dropped into its child groups/layers
  - Fix: Allow tiled layers to be moved between different tiled layer groups
+ - Fix: Theming using first rule as template now preserves transparency
+ - Fix: Restore missing checkbox for toggling Tiled Layer Group visibility in a Map Definition
 
 4.0.2
 -----

Modified: branches/maestro-4.0.x/Maestro.Editors/FeatureSource/Providers/Rdbms/RdbmsBaseCtrl.cs
===================================================================
--- branches/maestro-4.0.x/Maestro.Editors/FeatureSource/Providers/Rdbms/RdbmsBaseCtrl.cs	2012-09-13 17:05:53 UTC (rev 7014)
+++ branches/maestro-4.0.x/Maestro.Editors/FeatureSource/Providers/Rdbms/RdbmsBaseCtrl.cs	2012-09-13 17:13:18 UTC (rev 7015)
@@ -55,8 +55,13 @@
         private IEditorService _service;
         private IFeatureSource _fs;
 
+        private bool _bChangedUsername = false;
+        private bool _bChangedPassword = false;
+
         public override void Bind(IEditorService service)
         {
+            _bChangedUsername = false;
+            _bChangedPassword = false;
             _service = service;
             _service.BeforeSave += OnBeforeSave;
             _service.BeforePreview += OnBeforePreview;
@@ -71,8 +76,7 @@
             if (!_service.IsNew)
             {
                 txtUsername.Text = _fs.GetEncryptedUsername() ?? _fs.GetConnectionProperty("Username");
-                //txtPassword.Text = _fs.GetConnectionProperty("Password");
-                OnResourceChanged();
+                txtPassword.Text = GenerateRandomFakeString();
             }
 
             //Set initial value of data store if possible
@@ -88,6 +92,7 @@
 
             txtUsername.TextChanged += (s, e) =>
             {
+                _bChangedUsername = true;
                 if (string.IsNullOrEmpty(txtUsername.Text))
                     _fs.SetConnectionProperty("Username", null);
                 else
@@ -96,6 +101,7 @@
             
             txtPassword.TextChanged += (s, e) =>
             {
+                _bChangedPassword = true;
                 if (string.IsNullOrEmpty(txtPassword.Text))
                     _fs.SetConnectionProperty("Password", null);
                 else
@@ -109,6 +115,23 @@
 
         }
 
+        private string GenerateRandomFakeString()
+        {
+            Random rng = new Random();
+            char[] letters = new char[rng.Next(6, 12)];
+            for (int i = 0; i < letters.Length; i++)
+            {
+                letters[i] = GenerateChar(rng);
+            }
+            return new string(letters);
+        }
+
+        private static char GenerateChar(Random rng)
+        {
+            // 'Z' + 1 because the range is exclusive
+            return (char)(rng.Next('A', 'Z' + 1));
+        }
+
         void OnBeforePreview(object sender, EventArgs e)
         {
             WriteEncryptedCredentials();
@@ -128,10 +151,13 @@
             {
                 if (username != "%MG_USERNAME%" && password != "%MG_PASSWORD%")
                 {
-                    _fs.SetConnectionProperty("Username", "%MG_USERNAME%");
-                    _fs.SetConnectionProperty("Password", "%MG_PASSWORD%");
-                    _fs.SetEncryptedCredentials(username, password);
-                    _service.SyncSessionCopy();
+                    if (_bChangedUsername || _bChangedPassword)
+                    {
+                        _fs.SetConnectionProperty("Username", "%MG_USERNAME%"); //NOXLATE
+                        _fs.SetConnectionProperty("Password", "%MG_PASSWORD%"); //NOXLATE
+                        _fs.SetEncryptedCredentials(username, password);
+                        _service.SyncSessionCopy();
+                    }
                 }
             }
             else if (string.IsNullOrEmpty(username) && string.IsNullOrEmpty(password))



More information about the mapguide-commits mailing list