예제 #1
0
        public TFSUserWrapper(TeamExplorerIntergator teamExplorer)
        {
            tpCollection    = teamExplorer.tpCollection;
            teamProjectName = teamExplorer.tpName;

            secSrv = (IGroupSecurityService)tpCollection.GetService(typeof(IGroupSecurityService));
        }
        public void GetUserName(TfsTeamProjectCollection tfs)
        {
            BindingList <KeyValuePair <string, string> > userdata = new BindingList <KeyValuePair <string, string> >();
            IGroupSecurityService gss = (IGroupSecurityService)tfs.GetService(typeof(IGroupSecurityService));
            Identity SIDS             = gss.ReadIdentity(SearchFactor.AccountName, "Project Collection Valid Users", QueryMembership.Expanded);

            Identity[] UserId = gss.ReadIdentities(SearchFactor.Sid, SIDS.Members, QueryMembership.None);

            foreach (Identity user in UserId)
            {
                if (user == null)
                {
                    continue;
                }
                else if (!user.SecurityGroup)
                {
                    userdata.Add(new KeyValuePair <string, string>("q1", user.Domain + @"\" + user.AccountName));
                }
            }

            cmbUser.DataSource = null;
            cmbUser.Items.Clear();

            cmbUser.DataSource    = new BindingSource(userdata, null);
            cmbUser.DisplayMember = "Value";
            cmbUser.ValueMember   = "Key";
        }
예제 #3
0
        private void btnTeamProject_Click(object sender, EventArgs e)
        {
            TeamProjectPicker pp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false);

            pp.ShowDialog();

            if (pp.SelectedTeamProjectCollection != null)
            {
                TfsTeamProjectCollection tpc = pp.SelectedTeamProjectCollection;
                tpc.EnsureAuthenticated();
                _wiStore = (WorkItemStore)tpc.GetService(typeof(WorkItemStore));
                gss      = (IGroupSecurityService)tpc.GetService(typeof(IGroupSecurityService));

                if (pp.SelectedProjects != null)
                {
                    project = _wiStore.Projects[pp.SelectedProjects[0].Name];

                    var setting = new TFSProjectSetting()
                    {
                        Collection  = pp.SelectedTeamProjectCollection.Uri.ToString(),
                        TeamProject = project.Name
                    };

                    SaveTFSConnection(setting);
                }
            }

            InitProject();
        }
예제 #4
0
        public TFSUserWrapper(string tpCollectionUrl, string aTeamProjectName)
        {
            tpCollection    = new TfsTeamProjectCollection(new Uri(tpCollectionUrl));
            teamProjectName = aTeamProjectName;

            secSrv = (IGroupSecurityService)tpCollection.GetService(typeof(IGroupSecurityService));
        }
예제 #5
0
        /// <summary>
        /// Retrieves all TFS users and populates the Users property.
        /// </summary>
        private void PopulateUsers()
        {
            Users = new List <string>();

            // These must use QueryMembership.Expanded otherwise additional information doesn't get returned
            IGroupSecurityService service = TfsCollection.GetService <IGroupSecurityService>();

            Identity usersInCollection = service.ReadIdentity(SearchFactor.AccountName, "Project Collection Valid Users", QueryMembership.Expanded);

            Identity[] members = service.ReadIdentities(SearchFactor.Sid, usersInCollection.Members, QueryMembership.Expanded);

            for (int i = 0; i < members.Length; i++)
            {
                // Basic filtering
                if (!members[i].SecurityGroup)                 //&& !usernames.Contains(username))
                {
                    string name = members[i].DisplayName;
                    if (string.IsNullOrEmpty(name))
                    {
                        name = members[i].AccountName;
                    }

                    _users.Add(name);
                }
            }

            _users.Sort();
        }
예제 #6
0
 public UsersLocator(IGroupSecurityService groupSecurityService, VersionControlServer versionControlServer,
                          TeamProject teamProject, IGroupsLocator groupsLocator)
 {
     m_groupSecurityService = groupSecurityService;
     m_versionControlServer = versionControlServer;
     m_teamProject = teamProject;
     m_groupsLocator = groupsLocator;
 }
예제 #7
0
        public IEnumerable <Identity> GetAllUsersInTFSBasedOnIdentity()
        {
            Collection.EnsureAuthenticated();
            IGroupSecurityService gss = Collection.GetService <IGroupSecurityService>();
            Identity SIDS             = gss.ReadIdentity(SearchFactor.AccountName, "Project Collection Valid Users", QueryMembership.Expanded);

            return(gss.ReadIdentities(SearchFactor.Sid, SIDS.Members, QueryMembership.None));
        }
예제 #8
0
        public async Task <Identity[]> GetAllUsersInTFSBasedOnIdentityAsync()
        {
            Collection.EnsureAuthenticated();
            IGroupSecurityService gss = Collection.GetService <IGroupSecurityService>();
            Identity SIDS             = gss.ReadIdentity(SearchFactor.AccountName, "Project Collection Valid Users", QueryMembership.Expanded);
            var      readUsersTask    = Task.Factory.StartNew(() => gss.ReadIdentities(SearchFactor.Sid, SIDS.Members, QueryMembership.None).OrderBy(u => u.DisplayName).Select(u => u).ToArray());

            return(await readUsersTask);
        }
예제 #9
0
        private static IEnumerable <Identity> GetUsers(TfsProject SourceProject)
        {
            HashSet <Identity>    users       = new HashSet <Identity>();
            Queue <Identity>      queuedItems = new Queue <Identity>();
            IGroupSecurityService gss         = SourceProject.collection.GetService <IGroupSecurityService>();
            Identity SIDS = gss.ReadIdentity(SearchFactor.AccountName, "Project Collection Valid Users", QueryMembership.Expanded);

            Identity[] sourceUserIds = gss.ReadIdentities(SearchFactor.Sid, SIDS.Members, QueryMembership.Direct);
            foreach (var item in sourceUserIds)
            {
                if (item != null)
                {
                    queuedItems.Enqueue(item);
                }
            }

            while (queuedItems.Any())
            {
                var firstSid = queuedItems.Dequeue();
                if (firstSid == null)
                {
                    continue;
                }
                try
                {
                    users.Add(firstSid);
                    if (firstSid.Members.Length == 0)
                    {
                        continue;
                    }
                    Identity[] members = gss.ReadIdentities(SearchFactor.Sid, firstSid.Members, QueryMembership.Direct);
                    foreach (var item in members)
                    {
                        if (item == null)
                        {
                            continue;
                        }
                        if (users.Add(item))
                        {
                            if (item.Type == IdentityType.WindowsUser)
                            {
                                continue;
                            }
                            queuedItems.Enqueue(item);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex);
                }
            }

            return(users);
        }
예제 #10
0
        /// <summary>
        /// Connects the specified tfsServer name.
        /// </summary>
        /// <returns></returns>
        public static bool Connect(LoginInfo info)
        {
            Disconnect();

            bool loginByLoggedUser = info.UserName == null;

            UIContext.Instance.LogMessage(new IconListEntry
            {
                Icon = UIContext.Instance.GetLogImage(LogImage.Info),
                Text = string.Format("Connecting to server '{0}' using '{1}'...",
                                     info.ServerName,
                                     loginByLoggedUser
                            ? "current windows logged user credentials"
                            : string.Format("credentials with user name '{0}' and domain: '{1}'", info.UserName, info.Domain))
            });

            loginInfo = info;
            bool result = TFSUtils.TestConnection(info);

            if (result)
            {
                tfsServer = TFSUtils.LastConnectedServer;
                result    = (tfsServer != null);
                if (result)
                {
                    eventService    = (IEventService)tfsServer.GetService(typeof(IEventService));
                    cSSproxy        = (ICommonStructureService)tfsServer.GetService(typeof(ICommonStructureService));
                    itemStore       = (WorkItemStore)tfsServer.GetService(typeof(WorkItemStore));
                    securityService = (IGroupSecurityService)tfsServer.GetService(typeof(IGroupSecurityService));
                    buildServer     = (IBuildServer)tfsServer.GetService(typeof(IBuildServer));
                    controlServer   = (VersionControlServer)tfsServer.GetService(typeof(VersionControlServer));
                }
            }

            isConnected = result;

            if (result)
            {
                UIContext.Instance.LogMessage(new IconListEntry
                {
                    Icon = UIContext.Instance.GetLogImage(LogImage.Info),
                    Text = string.Format("Connected successfully as: {0} ({1})", Context.LoggedDisplayUser, Context.LoggedUser)
                });
            }

            UIContext.Instance.LogMessage(new IconListEntry
            {
                Icon = UIContext.Instance.GetLogImage(result ? LogImage.Info : LogImage.Error),
                Text = string.Format("Connecting to server '{0}' {1}", info.ServerName, result ? "was successfull" : "failed")
            });

            return(result);
        }
예제 #11
0
    public void ShowIdentity()
    {
        IGroupSecurityService gss = Driver.TeamFoundationServer.GetService(typeof(IGroupSecurityService)) as IGroupSecurityService;
        Identity identity         = gss.ReadIdentity(SearchFactor.AccountName, Driver.Username, QueryMembership.Direct);

        Console.WriteLine("Account Name: " + identity.AccountName);
        Console.WriteLine("Description: " + identity.Description);
        Console.WriteLine("DisplayName: " + identity.DisplayName);
        Console.WriteLine("Distinguished Name: " + identity.DistinguishedName);
        Console.WriteLine("Domain: " + identity.Domain);
        Console.WriteLine("Mail Address: " + identity.MailAddress);
        Console.WriteLine("Sid: " + identity.Sid);
        Console.WriteLine("Type: " + identity.Type);
    }
예제 #12
0
        internal virtual void CheckBypassRulePermission()
        {
            // Verify whether the user is in the service account group. Throw an exception if it is not.
            IGroupSecurityService gss       = (IGroupSecurityService)m_srv.GetService(typeof(IGroupSecurityService));
            Identity serviceAccountIdentity = gss.ReadIdentity(SearchFactor.ServiceApplicationGroup, null, QueryMembership.None);

            if (!gss.IsMember(serviceAccountIdentity.Sid, m_srv.AuthenticatedUserIdentity.Sid))
            {
                throw new PermissionException(
                          string.Format(TfsWITAdapterResources.UserNotInServiceAccountGroup, m_srv.AuthenticatedUserIdentity.Domain + "\\" + m_srv.AuthenticatedUserIdentity.AccountName, m_srv.Uri.ToString()),
                          m_srv.AuthenticatedUserIdentity.AccountName, m_srv.AuthenticatedUserIdentity.Domain,
                          serviceAccountIdentity.DisplayName);
            }
        }
예제 #13
0
        /// <summary>
        /// Gets the users.
        /// </summary>
        /// <returns></returns>
        public List <TeamFoundationIdentity> GetUsers()
        {
            TfsTeamProjectCollection   projectCollection = this.GetTeamProjectCollection();
            ICommonStructureService    css = (ICommonStructureService)projectCollection.GetService(typeof(ICommonStructureService));
            IGroupSecurityService      gss = projectCollection.GetService <IGroupSecurityService>();
            IIdentityManagementService ims = projectCollection.GetService <IIdentityManagementService>();

            // get the tfs project
            var projectList = css.ListAllProjects();
            var project     = projectList.FirstOrDefault(o => o.Name.Equals(this.TfsServer.ActiveProjectContext.ProjectName, StringComparison.InvariantCultureIgnoreCase));

            // project doesn't exist
            if (project == null)
            {
                return(null);
            }

            // get the tfs group
            var groupList = gss.ListApplicationGroups(project.Uri);

            List <Identity> groups;

            if (ConfigurationManager.CurrentConfiguration.UserGroups != null && ConfigurationManager.CurrentConfiguration.UserGroups.Count > 0)
            {
                groups = groupList.Where(o => ConfigurationManager.CurrentConfiguration.UserGroups.Contains(o.AccountName)).ToList();  // you can also use DisplayName
            }
            else
            {
                groups = groupList.ToList();
            }

            List <TeamFoundationIdentity> contributors = new List <TeamFoundationIdentity>();

            foreach (Identity group in groups)
            {
                Identity sids = gss.ReadIdentity(SearchFactor.Sid, group.Sid, QueryMembership.Expanded);

                // there are no users
                if (sids.Members.Length == 0)
                {
                    continue;
                }

                // convert to a list
                contributors.AddRange(ims.ReadIdentities(IdentitySearchFactor.Identifier, sids.Members, MembershipQuery.Direct, ReadIdentityOptions.None).SelectMany(x => x).Where(x => x.IsContainer == false));
            }

            return(contributors.GroupBy(x => x.DisplayName).Select(g => g.First()).OrderBy(x => x.DisplayName).ToList());
        }
예제 #14
0
        /// <summary>
        /// Retreive User List of the Project
        /// </summary>
        /// <returns>List<string> of users</string></returns>
        public static List <string> RetreiveUserList()
        {
            List <string> userList = new List <string>();

            dicoUser     = new Dictionary <string, string>();
            dicoUserMail = new Dictionary <string, string>();

            //Call to Work Item Store to have access tfscoll and Get Services IGroupSecurityService
            GetWorkItemStore();

            IGroupSecurityService groupsecurityservice = (IGroupSecurityService)tfsColl.GetService <IGroupSecurityService>();

            if (vcs == null)
            {
                vcs = (VersionControlServer)tfsColl.GetService <VersionControlServer>();
            }
            TeamProject teamProject = vcs.GetTeamProject(tfsExt.ActiveProjectContext.ProjectName);

            Identity[] appGroups = groupsecurityservice.ListApplicationGroups(teamProject.ArtifactUri.AbsoluteUri);

            //Identity idSid = groupsecurityservice.ReadIdentity()
            foreach (Identity group in appGroups)
            {
                Identity[] groupMembers = groupsecurityservice.ReadIdentities(SearchFactor.Sid, new string[] { group.Sid }, QueryMembership.Expanded);

                foreach (Identity member in groupMembers)
                {
                    if (member.Members != null)
                    {
                        foreach (string memberSid in member.Members)
                        {
                            Identity memberInfo = groupsecurityservice.ReadIdentity(SearchFactor.Sid, memberSid, QueryMembership.None);
                            if (userList.Contains(memberInfo.DisplayName))
                            {
                                continue;
                            }
                            userList.Add(memberInfo.DisplayName);
                            dicoUser.Add(memberInfo.DisplayName, memberInfo.AccountName);
                            dicoUserMail.Add(memberInfo.DisplayName, memberInfo.MailAddress);
                        }
                    }
                }
            }
            userList.Sort();
            return(userList);
        }
예제 #15
0
        private void LoadDefaultTFSConnection()
        {
            var setting = LoadTFSConnection();

            if (setting != null)
            {
                var uri = new Uri(setting.Collection);
                TfsTeamProjectCollection tpc = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(uri);
                tpc.EnsureAuthenticated();
                _wiStore = (WorkItemStore)tpc.GetService(typeof(WorkItemStore));
                gss      = (IGroupSecurityService)tpc.GetService(typeof(IGroupSecurityService));

                project = _wiStore.Projects[setting.TeamProject];
            }

            InitProject();
        }
예제 #16
0
        public TeamManager(Dto.ProjectDetail projectDetail, TfsApi.Contracts.ITfsCredentials tfsCredentials)
        {
            this.tfsCredentials = tfsCredentials;

            this.projectDetail = projectDetail;

            this.tfsTeamProjectCollection = TfsApi.Administration.TfsTeamProjectCollectionFactory.GetTeamProjectCollection(this.projectDetail.CollectionUri, this.tfsCredentials);

            this.teamSettingsConfigurationService = this.tfsTeamProjectCollection.GetService<TeamSettingsConfigurationService>();

            this.commonStructureService = (ICommonStructureService4)this.tfsTeamProjectCollection.GetService(typeof(ICommonStructureService4));

            this.projectInfo = this.commonStructureService.GetProjectFromName(this.projectDetail.ProjectName);

            this.groupSecurityService = (IGroupSecurityService)this.tfsTeamProjectCollection.GetService<IGroupSecurityService>();

            this.TfsTeamService = (Microsoft.TeamFoundation.Client.TfsTeamService)this.tfsTeamProjectCollection.GetService(typeof(Microsoft.TeamFoundation.Client.TfsTeamService));
        }
예제 #17
0
        public TeamManager(Dto.ProjectDetail projectDetail, TfsApi.Contracts.ITfsCredentials tfsCredentials)
        {
            this.tfsCredentials = tfsCredentials;

            this.projectDetail = projectDetail;

            this.tfsTeamProjectCollection = TfsApi.Administration.TfsTeamProjectCollectionFactory.GetTeamProjectCollection(this.projectDetail.CollectionUri, this.tfsCredentials);

            this.teamSettingsConfigurationService = this.tfsTeamProjectCollection.GetService <TeamSettingsConfigurationService>();

            this.commonStructureService = (ICommonStructureService4)this.tfsTeamProjectCollection.GetService(typeof(ICommonStructureService4));

            this.projectInfo = this.commonStructureService.GetProjectFromName(this.projectDetail.ProjectName);

            this.groupSecurityService = (IGroupSecurityService)this.tfsTeamProjectCollection.GetService <IGroupSecurityService>();

            this.TfsTeamService = (Microsoft.TeamFoundation.Client.TfsTeamService) this.tfsTeamProjectCollection.GetService(typeof(Microsoft.TeamFoundation.Client.TfsTeamService));
        }
        static void Main(string[] args)
        {
            TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri("http://server:8080/tfs/DefaultCollection"));

            tfs.EnsureAuthenticated();

            IGroupSecurityService gss = tfs.GetService <IGroupSecurityService>();

            Identity SIDS = gss.ReadIdentity(SearchFactor.AccountName, "Project Collection Valid Users", QueryMembership.Expanded);

            Identity[] UserId = gss.ReadIdentities(SearchFactor.Sid, SIDS.Members, QueryMembership.Direct);

            foreach (Identity user in UserId)
            {
                if (user != null)
                {
                    Console.WriteLine(user.AccountName);
                    Console.WriteLine(user.Domain);
                }
            }
            Console.ReadKey();
        }
예제 #19
0
        public PermissionManager(Uri tfsCollectionUri)
        {
            FileHelper.CreateLogFile();
            TextWriterTraceListener myTextListener = new TextWriterTraceListener(Constants.LOG_FILE_NAME);

            myTextListener.TraceOutputOptions = TraceOptions.Timestamp;
            Trace.Listeners.Add(myTextListener);

            tpCollection = new TfsTeamProjectCollection(tfsCollectionUri);
            tpCollection.Authenticate();

            // TODO: ICommonStructureService3 is being used for backward compatibility with TFS 2010.
            // Replace with ICommonStructureService4, after migration to TFS15
            structureSvc = tpCollection.GetService <ICommonStructureService3>();
            // TODO: IGroupSecurityService is deprecated as of TFS 2012 and needs to be removed, after migration to TFS15
            // Use IIdentityManagementService for TFS15
            groupSecuritySvc = tpCollection.GetService <IGroupSecurityService>();
            // TODO: use for TFS15
            idMgmtSvc = tpCollection.GetService <IIdentityManagementService>();

            FileHelper.Log("Connection established and Identity Management Service instance created.");
        }
        static void Main(string[] args)
        {
            string project = "http://xxx.xxx.xxx.xxx:8080/tfs";
            TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri(project));
            var tps = tpc.GetService <VersionControlServer>();
            var ttt = tps.GetTeamProject("ProjectName");
            ISecurityService securityService = tpc.GetService <ISecurityService>();

            System.Collections.ObjectModel.ReadOnlyCollection <SecurityNamespace> securityNamespaces = securityService.GetSecurityNamespaces();
            IGroupSecurityService gss             = tpc.GetService <IGroupSecurityService>();
            Identity                 SIDS         = gss.ReadIdentity(SearchFactor.AccountName, "GroupName", QueryMembership.Expanded);//GourName format: [ProjectName]\\GourpName
            IdentityDescriptor       id           = new IdentityDescriptor("Microsoft.TeamFoundation.Identity", SIDS.Sid);
            List <SecurityNamespace> securityList = securityNamespaces.ToList <SecurityNamespace>();
            string securityToken;

            foreach (SecurityNamespace sn in securityList)
            {
                if (sn.Description.DisplayName == "Project")
                {
                    securityToken = "$PROJECT:" + ttt.ArtifactUri.AbsoluteUri;
                    sn.SetPermissions(securityToken, id, 115, 0, true);
                }
            }
        }
예제 #21
0
        internal static void CheckBypassRulePermission(TfsTeamProjectCollection tfs)
        {
            // Verify whether the user is in the service account group. Throw an exception if it is not.
            IGroupSecurityService gss       = (IGroupSecurityService)tfs.GetService(typeof(IGroupSecurityService));
            Identity serviceAccountIdentity = gss.ReadIdentity(SearchFactor.ServiceApplicationGroup, null, QueryMembership.None);

            TeamFoundationIdentity authenticatedUser;

            tfs.GetAuthenticatedIdentity(out authenticatedUser);
            if (null == authenticatedUser)
            {
                return;
            }

            Identity authenticatedUserId = gss.Convert(authenticatedUser);

            if (!gss.IsMember(serviceAccountIdentity.Sid, authenticatedUserId.Sid))
            {
                throw new PermissionException(
                          string.Format(TfsWITAdapterResources.UserNotInServiceAccountGroup, authenticatedUser.DisplayName, tfs.Uri.ToString()),
                          authenticatedUserId.AccountName, authenticatedUserId.Domain, serviceAccountIdentity.DisplayName);
            }
            TraceManager.TraceInformation("BypassRulePermission verified for user '{0}'", authenticatedUser.DisplayName);
        }
예제 #22
0
        /// <summary>
        /// Check if the the current user is part of Service Accounts
        /// </summary>
        /// <param name="bisUri">Application Tier URI</param>
        /// throws ConverterException if the user is not part of 'Service Accounts' security group
        internal static void IsCurrentUserInServiceAccount(string bisUri)
        {
            try
            {
                // initialize gss
                TeamFoundationServer  tfs = TeamFoundationServerFactory.GetServer(bisUri);
                IGroupSecurityService gss = (IGroupSecurityService)tfs.GetService(typeof(IGroupSecurityService));

                // Get the Service Account group identity
                Identity serviceGroup = gss.ReadIdentity(SearchFactor.ServiceApplicationGroup, string.Empty, QueryMembership.None);
                Debug.Assert(serviceGroup != null, "serviceGroup != null");

                // check if this is Windows AD user or workgroup user
                int    res       = 0;
                IntPtr ptrDomain = IntPtr.Zero;
                bool   isDomain  = true;
                int    status    = 0;
                try
                {
                    res = NetGetJoinInformation(null, out ptrDomain, out status);
                    if (0 == res && 2 == status)    // workgroup name
                    {
                        isDomain = false;
                    }
                }
                finally
                {
                    if (IntPtr.Zero != ptrDomain)
                    {
                        NetApiBufferFree(ptrDomain);
                    }
                }

                string currentUser = String.Empty;
                if (!isDomain)
                {
                    // workgroup user..
                    currentUser = Environment.UserName;
                }
                else
                {
                    // windows AD user
                    currentUser = String.Concat(Environment.UserDomainName, Path.DirectorySeparatorChar, Environment.UserName);
                }

                Identity user = gss.ReadIdentity(SearchFactor.AccountName, currentUser, QueryMembership.None);
                if (user == null || gss.IsMember(serviceGroup.Sid, user.Sid) == false)
                {
                    // not part of service accounts group
                    string errMsg = UtilityMethods.Format(
                        VSTSResource.VstsUserNotInServiceAccounts, currentUser);
                    throw new ConverterException(errMsg);
                }
            }
            catch (Exception e)
            {
                if (e is ConverterException)
                {
                    throw;
                }

                throw new ConverterException(e.Message, e);
            }
        }
예제 #23
0
        /*BinarySearch----------------
         * public static int BinarySearch(int start, int end)
         * {
         *
         *  int mid = (start + end) / 2;
         *  Changeset cs = null;
         *  try
         *  {
         *      while (true)
         *      {
         *          if (version.GetChangeset(mid) != null)
         *          {
         *              cs = version.GetChangeset(mid);
         *              break;
         *          }
         *          else
         *          {
         *              mid++;
         *          }
         *      }
         *      if (cs.CreationDate.CompareTo(DateStart) < 0)
         *      {
         *
         *          BinarySearch(mid, end);
         *
         *      }
         *      if (cs.CreationDate.CompareTo(DateEnd) > 0)
         *      {
         *
         *          BinarySearch(start, mid);
         *      }
         *
         *
         *      return mid;
         *
         *
         *
         *
         *  }
         *
         *  catch (ResourceAccessException)
         *  {
         *      return BinarySearch(start + 1, end);
         *  }
         *
         *
         * }
         */
        static void Main(string[] args)
        {
            Console.WriteLine("123!");

            //查询时间
            Boolean startDateBoo = true;

            while (startDateBoo)
            {
                try
                {
                    //DateTime.TryParse(string.Format("{yyyy-MM-DD}:00", starttime),out dt);
                    // /*
                    //* 暂时注释,输入时间 datestart and dateend,try timeformate catch

                    System.Console.Write("Input the start time (yyyy-mm-dd): ");
                    startdate = Console.ReadLine();
                    string starttime = startdate + " 00:00:00";
                    DateStart    = DateTime.ParseExact(starttime, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
                    startDateBoo = false;
                }
                catch (FormatException)
                {
                    Console.WriteLine("Unable to convert to date");
                    startDateBoo = true;
                }
            }

            Boolean endDateBoo = true;

            while (endDateBoo)
            {
                System.Console.Write("Input the end time (yyyy-mm-dd): ");
                enddate = Console.ReadLine();
                string endtime = enddate + " 23:59:59";
                try
                {
                    DateEnd    = DateTime.ParseExact(endtime, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
                    endDateBoo = false;
                }
                catch (FormatException)
                {
                    Console.WriteLine("Unable to convert to date");
                    endDateBoo = true;
                }
            }

            //创建文件
            //StreamWriter sw = File.AppendText(System.Environment.CurrentDirectory + "\\AnalysisResult.csv");
            FileStream fs = new FileStream(Environment.CurrentDirectory + "\\" + startdate + "---" + enddate + "_Result.csv", FileMode.OpenOrCreate, FileAccess.Write, FileShare.Read);

            fs.SetLength(0);
            StreamWriter sw = new StreamWriter(fs);

            sw.WriteLine("changesetID,owner,group,createDate,branch,linkID,linktype,comment");

            //服务器连接,相关对象的获取
            TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri("https://tfs.slb.com/tfs/Real-Time_Collection/"));

            //版本控制
            version = tpc.GetService(typeof(VersionControlServer)) as VersionControlServer;
            //--------------------------team group-------------------------------------------

            TeamProject[] tepro      = version.GetAllTeamProjects(true);
            TeamProject   mypro      = tepro[0];
            string        rootFolder = mypro.ArtifactUri.AbsoluteUri;

            IGroupSecurityService gss = (IGroupSecurityService)tpc.GetService(typeof(IGroupSecurityService));

            Identity[] appGroups = gss.ListApplicationGroups(rootFolder);
            ArrayList  RtGroup   = new ArrayList();

            for (int k = 0; k < appGroups.Length; k++)
            {
                Identity group = appGroups[k];
                //Console.WriteLine(k +"  " +group.DisplayName + "**************************");
                if ("Real time".Equals(group.DisplayName))
                {
                    Identity[] groupMembers = gss.ReadIdentities(SearchFactor.Sid, new string[] { group.Sid }, QueryMembership.Expanded);
                    foreach (Identity member in groupMembers)
                    {
                        if (member.Members != null)
                        {
                            //Console.WriteLine(member.Members.Length);
                            //Thread.Sleep(3000);
                            foreach (string memberSid in member.Members)
                            {
                                Identity memberInfo = gss.ReadIdentity(SearchFactor.Sid, memberSid, QueryMembership.Expanded);
                                //Console.WriteLine(memberInfo.DisplayName);
                                RtGroup.Add(memberInfo.DisplayName);
                            }
                        }
                    }
                }
            }
            //------------------------------------------------------------------

            VersionSpec fromDateVersion = new DateVersionSpec(DateStart);
            VersionSpec toDateVersion   = new DateVersionSpec(DateEnd);
            // using versionControl API you can query histroy for changes set
            IEnumerable changesets = version.QueryHistory(string.Concat("$/", mypro.Name), VersionSpec.Latest, 0, RecursionType.Full, null, fromDateVersion, toDateVersion, int.MaxValue, true, true);

            System.Console.WriteLine("-----------");
            foreach (Changeset changeset in changesets)
            {
                Changeset cs = changeset;
                System.Console.WriteLine(cs.ChangesetId + " *** " + cs.CommitterDisplayName);
                Change[] thchan  = cs.Changes;
                string   branch  = thchan[0].Item.ServerItem;
                String[] braPath = branch.Split('/');
                if (braPath.Length > 4)
                {
                    branch = "";
                    for (int k = 1; k < 4; k++)
                    {
                        branch = branch + braPath[k] + "/";
                    }
                    if ("Release".Equals(braPath[3]))
                    {
                        branch = branch + braPath[4];
                    }
                }
                System.Console.WriteLine(branch);

                //associatedWork-----------------------------------
                AssociatedWorkItemInfo[] work = cs.AssociatedWorkItems;
                string linkid   = "";
                string linktype = "";
                if (work.Length == 1)
                {
                    linkid   = (work[0].Id).ToString();
                    linktype = work[0].WorkItemType;
                }
                else
                {
                    for (int k = 0; k < work.Length; k++)
                    {
                        if (!("Task".Equals(work[k].WorkItemType)))
                        {
                            linkid   = linkid + "[" + (k + 1) + "] " + (work[k].Id).ToString() + "  ";
                            linktype = linktype + "[" + (k + 1) + "] " + work[k].WorkItemType + "  ";
                        }
                        if (k == work.Length - 1 && "".Equals(linkid))
                        {
                            linkid   = (work[k].Id).ToString();
                            linktype = work[k].WorkItemType;
                        }
                    }
                }

                //teamInfo-----------------------------------
                string teamName = "othres";
                if (RtGroup.Contains(cs.CommitterDisplayName))
                {
                    teamName = "Real time";
                }
                //-----------------------------------

                sw.WriteLine("" + cs.ChangesetId + ',' + cs.CommitterDisplayName + ',' + teamName + ',' + cs.CreationDate + ',' + branch + ',' + linkid + ',' + linktype + ',' + Regex.Replace(cs.Comment, @"[\n\r]", ""));

                //foreach (Change change in changeset.Changes)
                //{
                //string fileName = change.Item.ServerItem;
                //}
            }

            /*原本查询方式
             * // changeset 相关信息的获取--------------------------------------
             * int latestId = version.GetLatestChangesetId();
             * Changeset cs;
             * for (int i = latestId; i>0; i--)
             * {
             *  try
             *  {
             *      cs = version.GetChangeset(i);
             *      if (cs == null)
             *      {
             *          System.Console.WriteLine("No result");
             *          continue;
             *      }
             *      if ((DateStart.CompareTo(cs.CreationDate)<=0) && ((DateEnd.CompareTo(cs.CreationDate)>=0)))
             *      {
             *          System.Console.WriteLine("changesetid:" + i + "!!");
             *          //branch
             *          Change[] thchan = cs.Changes;
             *          string branch = thchan[0].Item.ServerItem;
             *          String[] braPath = branch.Split('/');
             *          if (braPath.Length > 4)
             *          {
             *              branch ="";
             *              for (int k = 1; k < 4; k++)
             *              {
             *                  branch = branch + braPath[k] + "/";
             *              }
             *              if ("Release".Equals(braPath[3]))
             *              {
             *                  branch = branch + braPath[4];
             *              }
             *          }
             *          System.Console.WriteLine(branch);
             *
             *          //associatedWork-----------------------------------
             *          AssociatedWorkItemInfo[] work = cs.AssociatedWorkItems;
             *          string linkid = "";
             *          string linktype = "";
             *          if (work.Length == 1)
             *          {
             *              linkid = (work[0].Id).ToString();
             *              linktype = work[0].WorkItemType;
             *          }
             *          else
             *          {
             *              for (int k = 0; k < work.Length; k++)
             *              {
             *                  if (!("Task" .Equals(work[k].WorkItemType)))
             *                  {
             *                      linkid = linkid + "[" + (k + 1) + "] " + (work[k].Id).ToString();
             *                      linktype = linktype + "[" + (k + 1) + "] " + work[k].WorkItemType;
             *                  }
             *                  if (k == work.Length - 1 && "".Equals(linkid))
             *                  {
             *                      linkid = (work[k].Id).ToString();
             *                      linktype = work[k].WorkItemType;
             *                  }
             *
             *              }
             *          }
             *
             *          //teamInfo-----------------------------------
             *          string teamName = "othres";
             *          if (RtGroup.Contains(cs.CommitterDisplayName))
             *          {
             *              teamName = "Real time";
             *          }
             *          //-----------------------------------
             *
             *          sw.WriteLine("" + i + ',' + cs.CommitterDisplayName + ',' + teamName + ',' + cs.CreationDate + ',' + branch + ','+ linkid + ',' + linktype + ',' + Regex.Replace(cs.Comment, @"[\n\r]", ""));
             *
             *      }
             *      if ((DateStart.CompareTo(cs.CreationDate) > 0))
             *      {
             *          break;
             *      }
             *  }
             *  catch (ResourceAccessException)
             *  {
             *      continue;
             *  }
             * }
             */

            sw.Close();
            fs.Close();
            System.Console.WriteLine("******end*****");
            Thread.Sleep(5000);
        }
예제 #24
0
 public IGroupsLocator New(IGroupSecurityService groupSecurityService)
 {
     return new GroupsLocator(groupSecurityService);
 }
예제 #25
0
 public GroupsLocator(IGroupSecurityService groupSecurityService)
 {
     m_groupSecurityService = groupSecurityService;
 }
 public TFSUserIdCache(IGroupSecurityService gss)
 {
     m_gss = gss;
 }
예제 #27
0
        private void GetTFSUsersFromServer()
        {
            try
            {
                gss = (IGroupSecurityService)server.GetService(typeof(IGroupSecurityService));
                SIDS = gss.ReadIdentity(SearchFactor.AccountName, _settings.TeamFoundationServerUserGroup, QueryMembership.Expanded);
                TFSUsers = gss.ReadIdentities(SearchFactor.Sid, SIDS.Members, QueryMembership.None);

            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.InnerException.ToString(), e.Message);
            }
        }
예제 #28
0
 public IUsersLocator New(IGroupSecurityService groupSecurityService, VersionControlServer versionControlServer, TeamProject teamProject, IGroupsLocator groupsLocator)
 {
     return new UsersLocator(groupSecurityService, versionControlServer, teamProject, groupsLocator);
 }
예제 #29
0
        static void Main(string[] args)
        {
            Console.WriteLine("123!");

            //查询时间
            Boolean startDateBoo = true;

            while (startDateBoo)
            {
                try
                {
                    //DateTime.TryParse(string.Format("{yyyy-MM-DD}:00", starttime),out dt);
                    // /*
                    //* 暂时注释,输入时间 datestart and dateend,try timeformate catch

                    System.Console.Write("Input the start time (yyyy-mm-dd): ");
                    startdate = Console.ReadLine();
                    string starttime = startdate + " 00:00:00";
                    DateStart    = DateTime.ParseExact(starttime, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
                    startDateBoo = false;
                }
                catch (FormatException)
                {
                    Console.WriteLine("Unable to convert to date");
                    startDateBoo = true;
                }
            }

            Boolean endDateBoo = true;

            while (endDateBoo)
            {
                System.Console.Write("Input the end time (yyyy-mm-dd): ");
                enddate = Console.ReadLine();
                string endtime = enddate + " 23:59:59";
                try
                {
                    DateEnd    = DateTime.ParseExact(endtime, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
                    endDateBoo = false;
                }
                catch (FormatException)
                {
                    Console.WriteLine("Unable to convert to date");
                    endDateBoo = true;
                }
            }

            //创建文件
            //StreamWriter sw = File.AppendText(System.Environment.CurrentDirectory + "\\AnalysisResult.csv");
            FileStream fs = new FileStream(Environment.CurrentDirectory + "\\" + startdate + "---" + enddate + "_Result.csv", FileMode.OpenOrCreate, FileAccess.Write, FileShare.Read);

            fs.SetLength(0);
            StreamWriter sw = new StreamWriter(fs);

            sw.WriteLine("ChangesetID,Owner,Group,CreateDate,Branch,LinkID,LinkType,Comment");

            //服务器连接,相关对象的获取
            TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri("https://tfs.slb.com/tfs/Real-Time_Collection/"));

            //版本控制
            version = tpc.GetService(typeof(VersionControlServer)) as VersionControlServer;

            //--------------------------team group-------------------------------------------
            System.Console.WriteLine("Getting Team Information......");
            TeamProject[] tepro      = version.GetAllTeamProjects(true);
            TeamProject   mypro      = tepro[0];
            string        rootFolder = mypro.ArtifactUri.AbsoluteUri;

            IGroupSecurityService gss = (IGroupSecurityService)tpc.GetService(typeof(IGroupSecurityService));

            Identity[] appGroups = gss.ListApplicationGroups(rootFolder);

            Dictionary <string, ArrayList> groupMap = new Dictionary <string, ArrayList>();

            ArrayList RTgroup = new ArrayList();

            RTgroup.Add("Yizhou WANG");
            groupMap.Add("Real time", RTgroup);
            groupMap.Add("Data delivery", new ArrayList());
            groupMap.Add("Photon", new ArrayList());
            groupMap.Add("ProXimity", new ArrayList());
            groupMap.Add("Visualization", new ArrayList());
            groupMap.Add("QA", new ArrayList());

            for (int k = 0; k < appGroups.Length; k++)
            {
                Identity group = appGroups[k];
                if (groupMap.ContainsKey(group.DisplayName))
                {
                    Identity[] groupMembers = gss.ReadIdentities(SearchFactor.Sid, new string[] { group.Sid }, QueryMembership.Expanded);
                    foreach (Identity member in groupMembers)
                    {
                        if (member.Members != null)
                        {
                            foreach (string memberSid in member.Members)
                            {
                                Identity memberInfo = gss.ReadIdentity(SearchFactor.Sid, memberSid, QueryMembership.Expanded);
                                groupMap[group.DisplayName].Add(memberInfo.DisplayName);
                            }
                        }
                    }
                }
            }
            //------------------------------------------------------------------

            VersionSpec fromDateVersion = new DateVersionSpec(DateStart);
            VersionSpec toDateVersion   = new DateVersionSpec(DateEnd);
            // using versionControl API you can query histroy for changes set
            IEnumerable changesets = version.QueryHistory(string.Concat("$/", mypro.Name), VersionSpec.Latest, 0, RecursionType.Full, null, fromDateVersion, toDateVersion, int.MaxValue, true, true);

            //查询 changeset 相关信息的获取--------------------------------------
            Dictionary <string, ArrayList> countUnlinked   = new Dictionary <string, ArrayList>();
            Dictionary <string, ArrayList> countTasklinked = new Dictionary <string, ArrayList>();

            System.Console.WriteLine("Query Changesets by Date......");
            string csTime = "";

            foreach (Changeset changeset in changesets)
            {
                Changeset cs = changeset;

                if (csTime.Equals(cs.CreationDate.ToShortDateString()) == false)
                {
                    if ("".Equals(csTime) == false)
                    {
                        System.Console.WriteLine("      done!");
                    }
                    csTime = cs.CreationDate.ToShortDateString().ToString();
                    System.Console.Write(csTime);
                }

                //System.Console.WriteLine(cs.ChangesetId + " *** " + cs.CommitterDisplayName);
                Change[] thchan  = cs.Changes;
                string   branch  = thchan[0].Item.ServerItem;
                String[] braPath = branch.Split('/');
                if (braPath.Length > 4)
                {
                    branch = "";
                    for (int k = 1; k < 4; k++)
                    {
                        branch = branch + braPath[k] + "/";
                    }
                    if ("Release".Equals(braPath[3]))
                    {
                        branch = branch + braPath[4];
                    }
                }
                //System.Console.WriteLine(branch);

                //teamInfo-----------------------------------
                string teamName = "others";
                foreach (KeyValuePair <string, ArrayList> groupInfo in groupMap)
                {
                    if (groupInfo.Value.Contains(cs.CommitterDisplayName))
                    {
                        teamName = groupInfo.Key;
                    }
                }

                //-----------------------------------

                //associatedWork-----------------------------------
                AssociatedWorkItemInfo[] work = cs.AssociatedWorkItems;
                string linkid   = "";
                string linktype = "";
                if (work == null || work.Length < 1)
                {
                    if (countUnlinked.ContainsKey(cs.CommitterDisplayName))
                    {
                        countUnlinked[cs.CommitterDisplayName].Add(cs.ChangesetId);
                    }
                    else
                    {
                        countUnlinked.Add(cs.CommitterDisplayName, new ArrayList());
                        countUnlinked[cs.CommitterDisplayName].Add(cs.ChangesetId);
                    }
                    sw.WriteLine("" + cs.ChangesetId + ',' + cs.CommitterDisplayName + ',' + teamName + ',' + cs.CreationDate + ',' + branch + ',' + linkid + ',' + linktype + ',' + Regex.Replace(cs.Comment, @"[\n\r]", ""));
                }
                else if (work.Length == 1)
                {
                    if ("Task".Equals(work[0].WorkItemType))
                    {
                        if (countTasklinked.ContainsKey(cs.CommitterDisplayName))
                        {
                            countTasklinked[cs.CommitterDisplayName].Add(cs.ChangesetId);
                        }
                        else
                        {
                            countTasklinked.Add(cs.CommitterDisplayName, new ArrayList());
                            countTasklinked[cs.CommitterDisplayName].Add(cs.ChangesetId);
                        }
                    }
                    linkid   = (work[0].Id).ToString();
                    linktype = work[0].WorkItemType;
                    sw.WriteLine("" + cs.ChangesetId + ',' + cs.CommitterDisplayName + ',' + teamName + ',' + cs.CreationDate + ',' + branch + ',' + linkid + ',' + linktype + ',' + Regex.Replace(cs.Comment, @"[\n\r]", ""));
                }
                else
                {
                    for (int k = 0; k < work.Length; k++)
                    {
                        if (!("Task".Equals(work[k].WorkItemType)))
                        {
                            linkid   = (work[k].Id).ToString();
                            linktype = work[k].WorkItemType;
                            sw.WriteLine("" + cs.ChangesetId + ',' + cs.CommitterDisplayName + ',' + teamName + ',' + cs.CreationDate + ',' + branch + ',' + linkid + ',' + linktype + ',' + Regex.Replace(cs.Comment, @"[\n\r]", ""));
                        }
                        if (k == work.Length - 1 && "".Equals(linkid))
                        {
                            if (countTasklinked.ContainsKey(cs.CommitterDisplayName))
                            {
                                countTasklinked[cs.CommitterDisplayName].Add(cs.ChangesetId);
                            }
                            else
                            {
                                countTasklinked.Add(cs.CommitterDisplayName, new ArrayList());
                                countTasklinked[cs.CommitterDisplayName].Add(cs.ChangesetId);
                            }
                            linkid   = (work[k].Id).ToString();
                            linktype = work[k].WorkItemType;
                            sw.WriteLine("" + cs.ChangesetId + ',' + cs.CommitterDisplayName + ',' + teamName + ',' + cs.CreationDate + ',' + branch + ',' + linkid + ',' + linktype + ',' + Regex.Replace(cs.Comment, @"[\n\r]", ""));
                        }
                    }
                }

                //sw.WriteLine("" + cs.ChangesetId + ',' + cs.CommitterDisplayName + ',' + teamName + ',' + cs.CreationDate + ',' + branch + ',' + linkid + ',' + linktype + ',' + Regex.Replace(cs.Comment, @"[\n\r]", ""));
            }

            sw.Close();
            fs.Close();
            System.Console.WriteLine("      done!");
            System.Console.WriteLine("**********end**********");

            // 统计信息
            FileStream cfs = new FileStream(Environment.CurrentDirectory + "\\" + startdate + "---" + enddate + "_Count.csv", FileMode.OpenOrCreate, FileAccess.Write, FileShare.Read);

            cfs.SetLength(0);
            StreamWriter csw = new StreamWriter(cfs);

            csw.WriteLine("Owner,Group,Unlinked,Task Linked");

            Dictionary <string, ArrayList> .KeyCollection keyUnlinked   = countUnlinked.Keys;
            Dictionary <string, ArrayList> .KeyCollection keyTasklinked = countTasklinked.Keys;

            IEnumerable <string> union    = keyUnlinked.Concat(keyTasklinked);
            HashSet <string>     unionSet = new HashSet <string>(union);

            foreach (string name in unionSet)
            {
                int unLinked   = 0;
                int taskLinked = 0;
                if (countUnlinked.ContainsKey(name))
                {
                    unLinked = countUnlinked[name].Count;
                }
                if (countTasklinked.ContainsKey(name))
                {
                    taskLinked = countTasklinked[name].Count;
                }
                string teamName = "others";
                foreach (KeyValuePair <string, ArrayList> groupInfo in groupMap)
                {
                    if (groupInfo.Value.Contains(name))
                    {
                        teamName = groupInfo.Key;
                    }
                }
                csw.WriteLine("" + name + ',' + teamName + ',' + unLinked + ',' + taskLinked);
            }
            csw.Close();
            cfs.Close();
            System.Console.WriteLine("**********Count Over**********");

            Thread.Sleep(5000);
        }
예제 #30
0
        /// <summary>
        /// On Button Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_dp_Click(object sender, EventArgs e)
        {
            /*Code for picking from Server Picker TFS control
            DomainProjectPicker dp = new DomainProjectPicker(DomainProjectPickerMode.AllowMultiSelect);
            if (dp.ShowDialog() != DialogResult.Cancel)
            {

            }*/

            //bgw.DoWork += new DoWorkEventHandler(bgw_DoWork);
            //bgw.ProgressChanged += new ProgressChangedEventHandler(bgw_ProgressChanged);
            //bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgw_RunWorkerCompleted);
            //bgw.WorkerReportsProgress = true;
            //bgw.RunWorkerAsync();
            //pbrProgress.Visible = true;

            string serverChecked;
            if(rtnGIRMS27.Checked)
                serverChecked= "GIRMS27";
            else
                serverChecked= "GIRMSC9";

            _server = new TeamFoundationServer("http://"+serverChecked+":8080");

            _server.EnsureAuthenticated();
            _versionControl = (VersionControlServer)_server.GetService(typeof(VersionControlServer));
            _securityService = (IGroupSecurityService)_server.GetService(typeof(IGroupSecurityService));

            teamProjects = _versionControl.GetAllTeamProjects(false);

            lstProjects.Items.Clear();
            lstProjects.Items.Add("All TFS Projects");
            lstProjects.Items.Add("");
            dtView.DataSource = null;
            dtView.Rows.Clear();
            _glUsers.Clear();

            foreach (TeamProject tp in teamProjects)
            {
                lstProjects.Items.Add(tp.Name);
                Identity[] appGroups = _securityService.ListApplicationGroups(tp.ArtifactUri.AbsoluteUri);
                foreach (Identity group in appGroups)
                {
                    Identity[] groupMembers = _securityService.ReadIdentities(SearchFactor.Sid, new string[] { group.Sid }, QueryMembership.Expanded);
                    if (groupMembers.Length == 0) break;
                    foreach (Identity member in groupMembers)
                    {
                        if (member.Members.Length == 0) break;
                        if (member.Members != null)
                        {
                            foreach (string memberSid in member.Members)
                            {
                                Identity memberInfo = _securityService.ReadIdentity(SearchFactor.Sid, memberSid, QueryMembership.None);
                                if (memberInfo.Type != IdentityType.WindowsUser) continue;

                                if (_glUsers.Contains(memberInfo.Sid))
                                    _userDetail = (UserDetails)_glUsers[memberInfo.Sid];
                                else
                                    _userDetail = new UserDetails(memberInfo);

                                //update the project and permission
                                _userDetail.TeamProject = tp.Name;
                                _userDetail.Permission = group.DisplayName;
                                _userDetail.UpdateProjectAndPermission(tp.Name, group.DisplayName);
                                if (_glUsers.ContainsKey(memberInfo.Sid))
                                    _glUsers.Remove(memberInfo.Sid);

                                _glUsers.Add(memberInfo.Sid, _userDetail);

                            }
                        }
                    }
                }

            }
            int sn = 0;
            dtView.Rows.Add(_glUsers.Count + 1);
            foreach (UserDetails userIdentity in _glUsers.Values)
            {
                dtView.Rows[sn].Cells[0].Value = userIdentity.UserName;
                dtView.Rows[sn].Cells[1].Value = userIdentity.ADId;
                dtView.Rows[sn].Cells[2].Value = userIdentity.EmailAdd;
                dtView.Rows[sn].Cells[3].Value = userIdentity.Domain;
                string v = string.Empty;
                Hashtable ht = userIdentity.PaR;
                foreach (string str in userIdentity.PaR.Values)
                {
                    v = string.Format("{0}{1}", v, str);
                }
                dtView.Rows[sn].Cells[4].Value = v;
                dtView.Rows[sn].Cells[5].Value = userIdentity.Status;
                sn++;
            }

            lblConnectedServer.Visible = true;
            lblServer.Text = serverChecked;
            frmTFSView.ActiveForm.Text = "Team Foundation Server - Projects & Users" + " : Connected To (" + serverChecked + ")";
            //pbrProgress.Visible = true;
        }