This project is read-only.

Small glitch in membership provider

Topics: Developer Forum
Dec 6, 2006 at 9:41 AM
While trying the features of MWPSK yesterday, I noticed that the "DeleteUser" method is not completely implemented.

If you remove members, previously assigned to roles, the Roles.config file will still contain old references to users that no longer exist in the system - fix:

  • Open the "CustomXmlMembershipProvider.cs" file and locate the "DeleteUser" method

  • Modify the method so that it looks like this:

public override bool DeleteUser(string username, bool deleteAllRelatedData)
{
DataRow[] rows = _users.Select(string.Format("Username='{0}'", username));
if (rows.Length > 0)
{
if (deleteAllRelatedData)
{
string[] roles = Roles.GetRolesForUser(username);
if (roles.Length > 0)
Roles.RemoveUserFromRoles(username, roles);
}

_users.Rows.Remove(rows0);
_users.AcceptChanges();
save();
return true;
}
else
{
return false;
}
}
Dec 6, 2006 at 10:11 AM
Thanks a lot

We will include this for 1.1.0


Urs

Dec 6, 2006 at 10:12 AM
This discussion has been copied to Work Item 6282. You may wish to continue further discussion there.
Dec 6, 2006 at 2:47 PM
Additional to that I found another bug in the managament of the roles, which were not updating after creating a new user.
Both fixes will be included in the next release candidate 1.1.0.

Best regards, Pascal