Freigeben über


deletecollection bug in SPUserUtil 2.5 - fix described

Someone noted this problem to me, and I just confirmed it to be a bug with the deletecollection operation in SPUserUtil.

The problem is that regardless of what you have specified in your usermap file when you run the deletecollection operation, it removes more users than you specified.

This is fixed in the current build, but in the released version in the utility suite, you'll need to make this slight correction:

In the file WebUserUtil.cs, in the method DeleteSiteUsers(), make the following change as noted in "Bug fix 07/24/2006"

 

/// <summary>

/// Removes any users found in the usermap from the specified site.

/// </summary>

/// <param name="site"></param>

/// <returns></returns>

public int DeleteSiteUsers(SPSite site)

{

   int iUser = 0;

   bool bContinue = false;

   Logging.Information("Deleting users from Site Collection");

   try

   {

      iUser = site.RootWeb.SiteUsers.Count;

      while (--iUser >= 0)

      {

         // BEGIN Bug fix 07/24/2006

         // Reset continue boolean.

         bContinue = false;

         // END Bug fix 07/24/2006

         SPUser user = site.RootWeb.SiteUsers[iUser]; // Can't use the itterator (foreach) while I'm deleting users.

         if(m_Options.strUserMapFileName != null)

         {

            UserMapItem uMap = getUserMap(user.LoginName); // See if this is a migrating user.

            if(uMap != null)

               bContinue=true;

         }

         ...

         ...

         ...

 - Keith

Comments

  • Anonymous
    July 27, 2006

    Hi, Keith,

    Trying to use the migrate feature of the wssuserutil.exe tool.
    The usermap file has only one <user> entry, but it is for a Domain Group, not for an account:
    <users>
     <user loginname="NT AUTHORITYauthenticated users" newloginname="KMdifferent users" displayname="NT AUTHORITYauthenticated users" email="diana@hello.ca" sid="S-1-6-1143535363" />
    </users>
    We are trying to replace the Domain Group:
    "NT AUTHORITYauthenticated users" with a different one, "KMdifferent users"

    Any workaround for migrating domain groups as well ?

    (Also, using the analyze feature of the same tool, the domain groups are not listed in the generated usermap .xml file.)
  • Anonymous
    July 27, 2006
    Hi Diana,

    You cannot use the migrate operation for groups.
    the documentation for -o migrate doesn't specifically call this out, but the Quick Migration Scenario does show where you migrate the users, but you have to clone the groups.

    The reason for this, is that the migrate APIs doe not handle migrating groups.

    This is documented in the following KBs
    http://support.microsoft.com/kb/896593/
    and I'll make sure this is clear in the updated SPUserUtil documentation.

    What you want to do, is use the -o clone operation to clone the security groups.

    Also, the analyze operation "Should" be listing the group information, if you can comment on the exact syntax your using for that, I'll try to see if I can help


  • Anonymous
    July 27, 2006
    Hi,Keith,

    ....Thank you very much for getting back to me so fast!!

    I am using this syntax:
    wssuserutil -o analyze -url http://gotorvmdev008:90/SiteCollection1/ -r -usermap C:OurFilesD1-users.xml -webfile C:OurFilesD1-webs.xml

    The D1-users.xml is listing all the users for all the subsites under my top collection SiteCollection1, except for the group information. E.g, for the SiteCollection1, I have 2 users and a domain group (under the Manage Users), but the usermap xml file is listing only the 2 users, not the domain group.

    Is this maybe because that domain group has special rights/permissions in AD?

    Many thanks again,
    Diana
  • Anonymous
    July 27, 2006
    It shouldn't matter that the group has special rights in AD...If it's showing up via manage users on the site collection, then there is enough information for the OM to get it.

    Feel free to use the "Email" feature on this blog to send me a direct email rather than the comment :) I'll try to reply as soon as possible :)
  • Anonymous
    May 27, 2008
    PingBack from http://music.findsongbylyricsblog.info/keith-richie-deletecollection-bug-in-spuserutil-25-fix-described/