private TeamFoundationIdentity ADSearchAssistResolveIdentityInternal( string id, MembershipQuery queryMembership, ReadIdentityOptions readIdentityOptions) { /* * obsoleting the usage of m_userIdCache to by-pass the TFS user idenitity scalability issue * * if (null == m_userIdCache) * { * return null; * } * string accountName = m_userIdCache.FindAccountName(id); * */ string accountName = ADUserSearcher.GetAccountName(id); if (string.IsNullOrEmpty(accountName)) { return(null); } else { return(m_identityManagement.ReadIdentity(IdentitySearchFactor.AccountName, accountName, queryMembership, readIdentityOptions)); } }
internal bool TryLookup( RichIdentity richIdentity, IdentityLookupContext context) { try { if (!string.IsNullOrEmpty(richIdentity.DisplayName)) { if (!m_adSearchOnly) { // "Jeff Smith" TeamFoundationIdentity id = ResolveIdentity(richIdentity.DisplayName, MembershipQuery.None, ReadIdentityOptions.None, IdentitySearchFactor.DisplayName); UpdateRichIdentity(richIdentity, id); return(true); } else { return(ADUserSearcher.TryUpdateAccountDetails(richIdentity.DisplayName, richIdentity)); } } else if (!string.IsNullOrEmpty(richIdentity.Alias) && !string.IsNullOrEmpty(richIdentity.Domain)) { if (!m_adSearchOnly) { // "Fabrikam\jeffsmith" string accountName = richIdentity.Domain + @"\" + richIdentity.Alias; TeamFoundationIdentity id = ResolveIdentity(accountName, MembershipQuery.None, ReadIdentityOptions.None, IdentitySearchFactor.AccountName); UpdateRichIdentity(richIdentity, id); return(true); } } else if (!string.IsNullOrEmpty(richIdentity.Alias)) { if (!m_adSearchOnly) { TeamFoundationIdentity id = ResolveIdentity(richIdentity.Alias, MembershipQuery.None, ReadIdentityOptions.None, IdentitySearchFactor.AccountName); UpdateRichIdentity(richIdentity, id); return(true); } } return(false); } catch (IdentityUnresolvedException unrslvEx) { TraceManager.TraceInformation(unrslvEx.Message); return(false); } catch (IllegalIdentityException illglIdEx) { TraceManager.TraceInformation(illglIdEx.Message); return(false); } }