How to remove legacy users                 Print      Add Favorite     Add Watch     Contact Author

Creator: host   4/12/2012 10:10:45 AM    Author: Sebastian Leupold   Source: http://www.dotnetnuke.com/Resources/Blogs/EntryId/2547/Tip-Remove-orphaned-super-users.aspx   Views: 308    0    0  
Tags:
Dotnetnuke User account


Posted by: Sebastian Leupold
3/28/2010  

In DNN 5, if you delete a portal, its users will show up in Host:: SuperUser Accounts. However, no reason to worry, hose users are not granted superuser privileges nor do they have access to any other portal in your DotNetNuke installation; the cause for them to show up is the superuser module, which shows all user records, which have no associated record in userportals table, like superusers. Starting with soft-delete users, if removing a portal, user records are not touched and those leftovers show up as Superusers and prevent re-using the usernames.

To fix this situation, you may run the following script from inside Host :: SQL:

DELETE FROM {databaseOwner}{objectQualifier}users 
WHERE userID NOT IN (SELECT userID from {databaseOwner}{objectQualifier}UserPortals) 
AND IsSuperuser = 0 DELETE FROM aspnet_membership 
WHERE UserID NOT IN 
(SELECT A.UserID FROM aspnet_users A INNER JOIN {databaseOwner}{objectQualifier}Users U ON A.UserName = U.UserName) 
DELETE FROM aspnet_users WHERE UserName NOT IN (SELECT UserName FROM {databaseOwner}{objectQualifier}Users) 

(tested with DotNetNuke version 5.3.1)


Rating People: 29   Average Rating:     
Comment List:


  No Record 


Post your comment

Your Name: Required
Your Mail: Email is used only to display Gravatar
Your Site:
CAPTCHA image
Enter the code shown above in the box below
Comment Info:         

     DnnModule.com is build to provide quality modules and skins, Some of them are free,some not. We wish these stuffs( free or not ) can be useful to you.

    Besides that, We also provide a full range of professional services, ranging from web site build, seo, system management, administration, support, senior consultancy and security services.   We act as if your development project or network was ours, with care and respect. We are not satisfied until it works the way you want it to, and we don't silently ignore found issues as somebody else's problem.