コード例 #1
0
        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));
        }
コード例 #2
0
        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;
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }