private TeamFoundationIdentity ResolveIdentityInternal( string id, MembershipQuery queryMembership, ReadIdentityOptions readIdentityOptions, IdentitySearchFactor searchFactor) { id = id.Trim(); try { TeamFoundationIdentity resolvedId = m_identityManagement.ReadIdentity(searchFactor, id, queryMembership, readIdentityOptions); if (null == resolvedId) { resolvedId = ADSearchAssistResolveIdentityInternal(id, queryMembership, readIdentityOptions); } return(resolvedId); } catch (System.NotSupportedException notSupportedEx) { if (notSupportedEx.Message.Contains(searchFactor.ToString()) && searchFactor == IdentitySearchFactor.DisplayName) { return(ADSearchAssistResolveIdentityInternal(id, queryMembership, readIdentityOptions)); } else { throw; } } }
private TeamFoundationIdentity ResolveIdentity( string id, MembershipQuery queryMembership, ReadIdentityOptions readIdentityOptions, IdentitySearchFactor searchFactor) { TraceManager.TraceInformation("Resolving Identity: {0}", id); TeamFoundationIdentity i = ResolveIdentityInternal(id, queryMembership, readIdentityOptions, searchFactor); if (i == null) { throw new IdentityUnresolvedException( string.Format("Identity '{0}' cannot be resolved", id ?? string.Empty)); } IdentityType type = Identity.GetType(i.Descriptor.IdentityType, i.IsContainer); if (type == IdentityType.InvalidIdentity) { throw new IdentityUnresolvedException( string.Format("Searching '{0}' returned invalid identity.", id ?? string.Empty)); } return(i); }
public IEnumerable <KeyValuePair <string, IEnumerable <ITeamFoundationIdentity> > > ReadIdentities( IdentitySearchFactor searchFactor, IEnumerable <string> searchFactorValues, MembershipQuery queryMembership) { if (searchFactorValues == null) { throw new ArgumentNullException(nameof(searchFactorValues)); } var searchFactorArray = searchFactorValues.ToArray(); var factor = (Microsoft.TeamFoundation.Framework.Common.IdentitySearchFactor)searchFactor; var identities = _identityManagementService2.ReadIdentities( factor, searchFactorArray, (Microsoft.TeamFoundation.Framework.Common.MembershipQuery)queryMembership, ReadIdentityOptions.IncludeReadFromSource); if (searchFactorArray.Length != identities.Length) { throw new IndexOutOfRangeException( "A call to IIdentityManagementService2.ReadIdentities resulted in a return set where there was not a one to one mapping between search terms and search results. This is unexpected behavior and execution cannot continue. Please check if the underlying service implementation has changed and update the consuming code as appropriate."); } for (var i = 0; i < searchFactorArray.Length; i++) { // TODO: Use configuration options from IWorkItemStore to control proxy creation var proxiedIdentities = identities[i].Select(id => id.AsProxy()); yield return(new KeyValuePair <string, IEnumerable <ITeamFoundationIdentity> >(searchFactorArray[i], proxiedIdentities)); } }
public Microsoft.TeamFoundation.Framework.Client.TeamFoundationIdentity ReadIdentity( #pragma warning disable RECS0154 // Parameter is never used IdentitySearchFactor searchFactor, #pragma warning restore RECS0154 // Parameter is never used #pragma warning disable RECS0154 // Parameter is never used string searchFactorValue, #pragma warning restore RECS0154 // Parameter is never used #pragma warning disable RECS0154 // Parameter is never used Microsoft.TeamFoundation.Framework.Common.MembershipQuery queryMembership, #pragma warning restore RECS0154 // Parameter is never used #pragma warning disable RECS0154 // Parameter is never used ReadIdentityOptions readOptions) #pragma warning restore RECS0154 // Parameter is never used { throw new NotSupportedException(); }
public Microsoft.TeamFoundation.Framework.Client.TeamFoundationIdentity[][] ReadIdentities( #pragma warning disable RECS0154 // Parameter is never used IdentitySearchFactor searchFactor, #pragma warning restore RECS0154 // Parameter is never used #pragma warning disable RECS0154 // Parameter is never used string[] searchFactorValues, #pragma warning restore RECS0154 // Parameter is never used #pragma warning disable RECS0154 // Parameter is never used Microsoft.TeamFoundation.Framework.Common.MembershipQuery queryMembership, #pragma warning restore RECS0154 // Parameter is never used #pragma warning disable RECS0154 // Parameter is never used ReadIdentityOptions readOptions) #pragma warning restore RECS0154 // Parameter is never used { return(new[] { NullIdentities }); }
public ITeamFoundationIdentity ReadIdentity( IdentitySearchFactor searchFactor, string searchFactorValue, MembershipQuery queryMembership) { if (string.IsNullOrEmpty(searchFactorValue)) { throw new ArgumentException("Value cannot be null or empty.", nameof(searchFactorValue)); } // TODO: Use configuration options from IWorkItemStore to control proxy creation return(_identityManagementService2.ReadIdentity( (Microsoft.TeamFoundation.Framework.Common.IdentitySearchFactor)searchFactor, searchFactorValue, (Microsoft.TeamFoundation.Framework.Common.MembershipQuery)queryMembership, ReadIdentityOptions.IncludeReadFromSource) .AsProxy()); }
public IEnumerable <KeyValuePair <string, IEnumerable <ITeamFoundationIdentity> > > ReadIdentities( IdentitySearchFactor searchFactor, IEnumerable <string> searchFactorValues, MembershipQuery queryMembership) { Trace.TraceInformation($"Searching for {searchFactor}: {string.Join(", ", searchFactorValues)}"); switch (searchFactor) { // Alternate login username case IdentitySearchFactor.Alias: foreach (var keyValuePair in SearchByAlias(searchFactorValues)) { yield return(keyValuePair); } break; // Windows NT account name: domain\alias or [email protected] case IdentitySearchFactor.AccountName: foreach (var keyValuePair1 in SearchByAccountName(searchFactorValues)) { yield return(keyValuePair1); } break; // Display name case IdentitySearchFactor.DisplayName: foreach (var keyValuePair2 in SearchByDisplayName(searchFactorValues)) { yield return(keyValuePair2); } break; case IdentitySearchFactor.AdministratorsGroup: case IdentitySearchFactor.Identifier: case IdentitySearchFactor.MailAddress: case IdentitySearchFactor.General: throw new NotSupportedException(); } }
public Microsoft.TeamFoundation.Framework.Client.TeamFoundationIdentity[][] ReadIdentities( #pragma warning disable RECS0154 // Parameter is never used IdentitySearchFactor searchFactor, #pragma warning restore RECS0154 // Parameter is never used #pragma warning disable RECS0154 // Parameter is never used string[] searchFactorValues, #pragma warning restore RECS0154 // Parameter is never used #pragma warning disable RECS0154 // Parameter is never used Microsoft.TeamFoundation.Framework.Common.MembershipQuery queryMembership, #pragma warning restore RECS0154 // Parameter is never used #pragma warning disable RECS0154 // Parameter is never used ReadIdentityOptions readOptions, #pragma warning restore RECS0154 // Parameter is never used #pragma warning disable RECS0154 // Parameter is never used IEnumerable <string> propertyNameFilters, #pragma warning restore RECS0154 // Parameter is never used #pragma warning disable RECS0154 // Parameter is never used IdentityPropertyScope propertyScope) #pragma warning restore RECS0154 // Parameter is never used { throw new NotSupportedException(); }
public IEnumerable <KeyValuePair <string, IEnumerable <ITeamFoundationIdentity> > > ReadIdentities( IdentitySearchFactor searchFactor, IEnumerable <string> searchFactorValues) { return(ReadIdentities(searchFactor, searchFactorValues, MembershipQuery.None)); }
public IEnumerable <KeyValuePair <string, IEnumerable <ITeamFoundationIdentity> > > ReadIdentities(IdentitySearchFactor searchFactor, ICollection <string> searchFactorValues) { var searchFactorArray = searchFactorValues.ToArray(); var factor = (Tfs.Common.IdentitySearchFactor)searchFactor; var identities = _identityManagementService2.ReadIdentities(factor, searchFactorArray, Tfs.Common.MembershipQuery.None, Tfs.Common.ReadIdentityOptions.IncludeReadFromSource); if (searchFactorArray.Length != identities.Length) { throw new IndexOutOfRangeException("A call to IIdentityManagementService2.ReadIdentities resulted in a return set where there was not a one to one mapping between search terms and search results. This is unexpected behavior and execution cannot continue. Please check if the underlying service implementation has changed and update the consuming code as appropriate."); } for (var i = 0; i < searchFactorArray.Length; i++) { var proxiedIdentities = identities[i].Select(TryCreateProxy); yield return(new KeyValuePair <string, IEnumerable <ITeamFoundationIdentity> >(searchFactorArray[i], proxiedIdentities)); } }
/// <inheritdoc /> public ITeamFoundationIdentity ReadIdentity(IdentitySearchFactor searchFactor, string searchFactorValue, MembershipQuery queryMembership) { return(ReadIdentities(searchFactor, new[] { searchFactorValue }, queryMembership).First().Value.SingleOrDefault()); }
public static TeamFoundationIdentity GetTeamFoundationIdentity(string fullUserName, IdentitySearchFactor identitySearchFactor, TfsTeamProjectCollection tfsTeamProjectCollection) { IIdentityManagementService ims = (IIdentityManagementService)tfsTeamProjectCollection.GetService(typeof(IIdentityManagementService)); return(ims.ReadIdentity(identitySearchFactor, fullUserName, MembershipQuery.Direct, ReadIdentityOptions.None)); }
public IEnumerable <KeyValuePair <string, IEnumerable <ITeamFoundationIdentity> > > ReadIdentities(IdentitySearchFactor searchFactor, ICollection <string> searchFactorValues) { switch (searchFactor) { // Alternate login username case IdentitySearchFactor.Alias: foreach (var value in searchFactorValues) { if (_accountNameMappings.ContainsKey(value)) { yield return (new KeyValuePair <string, IEnumerable <ITeamFoundationIdentity> >( value, _accountNameMappings[value])); } else { yield return(new KeyValuePair <string, IEnumerable <ITeamFoundationIdentity> >(value, new ITeamFoundationIdentity[0])); } } break; // Windows NT account name: domain\alias. case IdentitySearchFactor.AccountName: foreach (var value in searchFactorValues) { yield return(new KeyValuePair <string, IEnumerable <ITeamFoundationIdentity> >( value, Locate(identity => identity.UniqueName.StartsWith(value, StringComparison.OrdinalIgnoreCase)))); } break; // Display name case IdentitySearchFactor.DisplayName: foreach (var value in searchFactorValues) { yield return (new KeyValuePair <string, IEnumerable <ITeamFoundationIdentity> >( value, Locate(identity => value.Equals(identity.DisplayName, StringComparison.OrdinalIgnoreCase) || identity.DisplayName.StartsWith(value, StringComparison.OrdinalIgnoreCase)))); } break; case IdentitySearchFactor.AdministratorsGroup: case IdentitySearchFactor.Identifier: case IdentitySearchFactor.MailAddress: case IdentitySearchFactor.General: throw new NotSupportedException(); } }
public TeamFoundationIdentity ReadIdentity(IdentitySearchFactor searchFactor, string searchFactorValue, MembershipQuery queryMembership, ReadIdentityOptions readOptions) { throw new NotImplementedException(); }
public TeamFoundationIdentity[][] ReadIdentities(IdentitySearchFactor searchFactor, string[] searchFactorValues, MembershipQuery queryMembership, ReadIdentityOptions readOptions, IEnumerable <string> propertyNameFilters, IdentityPropertyScope propertyScope) { throw new NotImplementedException(); }
public ITeamFoundationIdentity ReadIdentity( IdentitySearchFactor searchFactor, string searchFactorValue) { return(ReadIdentity(searchFactor, searchFactorValue, MembershipQuery.None)); }
public static TeamFoundationIdentity GetTeamFoundationIdentity(string fullUserName, IdentitySearchFactor identitySearchFactor, TfsTeamProjectCollection tfsTeamProjectCollection) { IIdentityManagementService ims = (IIdentityManagementService)tfsTeamProjectCollection.GetService(typeof(IIdentityManagementService)); return ims.ReadIdentity(identitySearchFactor, fullUserName, MembershipQuery.Direct, ReadIdentityOptions.None); }