Skip to content

Commit

Permalink
[preview] Fix for #1997 (#1998)
Browse files Browse the repository at this point in the history
Fix for #1997
  • Loading branch information
MrHinsh authored Mar 20, 2024
1 parent 8aadc6c commit 9843afa
Showing 1 changed file with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,29 @@ private List<IdentityItemData> GetUsersListFromServer(IGroupSecurityService gss)
var people = SIDS.Members.ToList().Where(x => x.Contains("\\")).Select(x => x);

List<IdentityItemData> foundUsers = new List<IdentityItemData>();
Log.LogTrace("TfsUserMappingEnricher::GetUsersListFromServer:foundUsers\\ {@foundUsers}", foundUsers);
foreach (string user in people)
{
var bits = user.Split('\\');
Identity sids = gss.ReadIdentity(SearchFactor.AccountName, bits[1], QueryMembership.Expanded);
foundUsers.Add(new IdentityItemData() { FriendlyName = sids.DisplayName, AccountName = sids.AccountName });
Log.LogDebug("TfsUserMappingEnricher::GetUsersListFromServer::[user:{user}] Atempting to load user", user);
try
{
var bits = user.Split('\\');
Identity sids = gss.ReadIdentity(SearchFactor.AccountName, bits[1], QueryMembership.Expanded);
if (sids != null)
{
foundUsers.Add(new IdentityItemData() { FriendlyName = sids.DisplayName, AccountName = sids.AccountName });
}
else
{
Log.LogDebug("TfsUserMappingEnricher::GetUsersListFromServer::[user:{user}] ReadIdentity returned null for {@bits}", user, bits);
}

}
catch (Exception ex)
{
Log.LogWarning("TfsUserMappingEnricher::GetUsersListFromServer::[user:{user}] Failed With {Exception}", user, ex.Message);
}

}
return foundUsers;
}
Expand Down

0 comments on commit 9843afa

Please sign in to comment.