private string GetEmailAddress(TeamFoundationRequestContext requestContext, PushNotification pushNotification) { var collectionUrl = new Uri(requestContext.GetCollectionUri()); var collection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(collectionUrl); var managementService = collection.GetService <IIdentityManagementService>(); TeamFoundationIdentity teamFoundationIdentity = managementService.ReadIdentity( IdentitySearchFactor.AccountName, pushNotification.AuthenticatedUserName, MembershipQuery.None, ReadIdentityOptions.None); return(teamFoundationIdentity.GetAttribute("Mail", null)); }
protected bool IsUserExempted(TeamFoundationRequestContext requestContext, PushNotification pushNotification) { string collectionUrl = requestContext.GetCollectionUri(); // client API TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri(collectionUrl)); var identityManagement = tfs.GetService<IIdentityManagementService>(); var requestIdentity = identityManagement.ReadIdentity(IdentitySearchFactor.AccountName, pushNotification.AuthenticatedUserName, MembershipQuery.Direct, ReadIdentityOptions.None); bool exempted = false; foreach (var groupName in this.Groups) { var groupIdentity = identityManagement.ReadIdentity(IdentitySearchFactor.AccountName, groupName, MembershipQuery.Direct, ReadIdentityOptions.None); exempted |= identityManagement.IsMember(groupIdentity.Descriptor, requestIdentity.Descriptor); }//for return exempted; }
protected bool IsUserExempted(TeamFoundationRequestContext requestContext, PushNotification pushNotification) { string collectionUrl = requestContext.GetCollectionUri(); // client API TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri(collectionUrl)); var identityManagement = tfs.GetService <IIdentityManagementService>(); var requestIdentity = identityManagement.ReadIdentity(IdentitySearchFactor.AccountName, pushNotification.AuthenticatedUserName, MembershipQuery.Direct, ReadIdentityOptions.None); bool exempted = false; foreach (var groupName in this.Groups) { var groupIdentity = identityManagement.ReadIdentity(IdentitySearchFactor.AccountName, groupName, MembershipQuery.Direct, ReadIdentityOptions.None); exempted |= identityManagement.IsMember(groupIdentity.Descriptor, requestIdentity.Descriptor); }//for return(exempted); }
private string GetEmailAddress(TeamFoundationRequestContext requestContext, PushNotification pushNotification) { var collectionUrl = new Uri(requestContext.GetCollectionUri()); var collection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(collectionUrl); var managementService = collection.GetService<IIdentityManagementService>(); TeamFoundationIdentity teamFoundationIdentity = managementService.ReadIdentity( IdentitySearchFactor.AccountName, pushNotification.AuthenticatedUserName, MembershipQuery.None, ReadIdentityOptions.None); return teamFoundationIdentity.GetAttribute("Mail", null); }