List:Commits« Previous MessageNext Message »
From:rburnett Date:May 7 2009 5:59pm
Subject:Connector/NET commit: r1599 - in branches/5.2: . MySql.Web/Providers/Source
View as plain text  
Modified:
   branches/5.2/CHANGES
   branches/5.2/MySql.Web/Providers/Source/RoleProvider.cs
Log:
- fixed bug in role provider that was causing it to not correctly fetch the application
  id which caused it to incorrectly report roles (bug #44414)

Modified: branches/5.2/CHANGES
===================================================================
--- branches/5.2/CHANGES	2009-05-05 19:30:41 UTC (rev 1598)
+++ branches/5.2/CHANGES	2009-05-07 15:59:54 UTC (rev 1599)
@@ -5,6 +5,8 @@
   schema collection so procs that use those types with parameters will work (bug #39409)
 - fixed problem where the connector would incorrectly report the length of utf8 columns
on servers
   6.0 and later.  This was caused by 6.0 now using 4 bytes for utf8 columns  
+- fixed bug in role provider that was causing it to not correctly fetch the application
+  id which caused it to incorrectly report roles (bug #44414)
   
 Version 5.2.6
 - cleaned up how stored procedure execution operated when the user does or does not have
execute privs

Modified: branches/5.2/MySql.Web/Providers/Source/RoleProvider.cs
===================================================================
--- branches/5.2/MySql.Web/Providers/Source/RoleProvider.cs	2009-05-05 19:30:41 UTC (rev
1598)
+++ branches/5.2/MySql.Web/Providers/Source/RoleProvider.cs	2009-05-07 15:59:54 UTC (rev
1599)
@@ -183,7 +183,7 @@
                         {
                             // either create a new user or fetch the existing user id
                             int userId = SchemaManager.CreateOrFetchUserId(connection,
-                                username, app.Id, true);
+                                username, app.FetchId(connection), true);
                             foreach (string rolename in rolenames)
                             {
                                 int roleId = GetRoleId(connection, rolename);
@@ -262,7 +262,7 @@
                             my_aspnet_Roles r ON uir.roleId=r.id 
                             WHERE r.name LIKE @rolename AND r.applicationId=@appId",
connection);
                         cmd.Parameters.AddWithValue("@rolename", rolename);
-                        cmd.Parameters.AddWithValue("@appId", app.Id);
+                        cmd.Parameters.AddWithValue("@appId", app.FetchId(connection));
                         cmd.ExecuteNonQuery();
 
                         // now delete the role itself
@@ -335,7 +335,7 @@
                     WHERE u.applicationId=@appId";
                     MySqlCommand cmd = new MySqlCommand(sql, connection);
                     cmd.Parameters.AddWithValue("@roleId", roleId);
-                    cmd.Parameters.AddWithValue("@appId", app.Id);
+                    cmd.Parameters.AddWithValue("@appId", app.FetchId(connection));
                     using (MySqlDataReader reader = cmd.ExecuteReader())
                     {
                         while (reader.Read())
@@ -377,7 +377,7 @@
                         WHERE u.applicationId=@appId AND 
                         u.name LIKE @userName AND r.name LIKE @roleName";
                     MySqlCommand cmd = new MySqlCommand(sql, connection);
-                    cmd.Parameters.AddWithValue("@appId", app.Id);
+                    cmd.Parameters.AddWithValue("@appId", app.FetchId(connection));
                     cmd.Parameters.AddWithValue("@userName", username);
                     cmd.Parameters.AddWithValue("@roleName", rolename);
                     int count = Convert.ToInt32(cmd.ExecuteScalar());
@@ -433,7 +433,7 @@
                         MySqlCommand cmd = new MySqlCommand(sql, connection);
                         cmd.Parameters.Add("@username", MySqlDbType.VarChar, 255);
                         cmd.Parameters.Add("@rolename", MySqlDbType.VarChar, 255);
-                        cmd.Parameters.AddWithValue("@appId", app.Id);
+                        cmd.Parameters.AddWithValue("@appId", app.FetchId(connection));
 
                         foreach (string username in usernames)
                         {
@@ -515,7 +515,7 @@
                     MySqlCommand cmd = new MySqlCommand(sql, connection);
                     cmd.Parameters.AddWithValue("@username", usernameToMatch);
                     cmd.Parameters.AddWithValue("@rolename", rolename);
-                    cmd.Parameters.AddWithValue("@appId", app.Id);
+                    cmd.Parameters.AddWithValue("@appId", app.FetchId(connection));
                     using (MySqlDataReader reader = cmd.ExecuteReader())
                     {
                         while (reader.Read())
@@ -556,7 +556,7 @@
                         GetUserId(connection, username);
                 sql += " WHERE r.applicationId=@appId";
                 MySqlCommand cmd = new MySqlCommand(sql, connection);
-                cmd.Parameters.AddWithValue("@appId", app.Id);
+                cmd.Parameters.AddWithValue("@appId", app.FetchId(connection));
                 using (MySqlDataReader reader = cmd.ExecuteReader())
                 {
                     while (reader.Read())
@@ -578,7 +578,7 @@
                 "SELECT id FROM my_aspnet_Users WHERE name=@name AND
applicationId=@appId",
                 connection);
             cmd.Parameters.AddWithValue("@name", username);
-            cmd.Parameters.AddWithValue("@appId", app.Id);
+            cmd.Parameters.AddWithValue("@appId", app.FetchId(connection));
             object id = cmd.ExecuteScalar();
             return Convert.ToInt32(id);
         }
@@ -589,7 +589,7 @@
                 "SELECT id FROM my_aspnet_Roles WHERE name=@name AND
applicationId=@appId",
                 connection);
             cmd.Parameters.AddWithValue("@name", rolename);
-            cmd.Parameters.AddWithValue("@appId", app.Id);
+            cmd.Parameters.AddWithValue("@appId", app.FetchId(connection));
             return (int)cmd.ExecuteScalar();
         }
 

Thread
Connector/NET commit: r1599 - in branches/5.2: . MySql.Web/Providers/Sourcerburnett7 May 2009