Beispiel #1
0
        /// <summary>
        /// Performs full refresh of both userList and userListTerm by pulling new results from LDAP.  Requires parameter of cover form to be passed in to function.
        /// </summary>
        /// <param name="cover">Cover form generated to display progress of user list update.</param>
        public static void UpdateUsernameLists(formProgress cover)
        {
            cover.ProgressMaximum = userList.Count + userListTerm.Count;
            cover.ProgressText    = "Creating searcher objects...";
            cover.Refresh();
            cover.ProgressRefresh();
            searcher.SearchRoot.Path     = "LDAP://OU=Users, OU=Springdale, DC=US, DC=PaschalCorp, DC=com";
            searcher.Filter              = "(objectClass=user)";
            termSearcher.SearchRoot.Path = "LDAP://OU=Terminated, OU=Springdale, DC=US, DC=PaschalCorp, DC=com";
            termSearcher.Filter          = "(objectClass=user)";

            cover.ProgressText = "Retrieving\r\nActive Users...";
            UsernameList       = new List <string> ();
            foreach (SearchResult res in userList)
            {
                UsernameList.Add((string)res.GetDirectoryEntry().Properties["samaccountname"].Value);
                cover.ProgressStep();
            }
            //cover.ProgressText = "Sorting...";
            UsernameList.Sort();

            cover.ProgressText = "Retrieving\r\nTerminated users...";
            //cover.ProgressMaximum = userListTerm.Count;
            UsernameListTerm = new List <string> ();
            foreach (SearchResult res in userListTerm)
            {
                UsernameListTerm.Add((string)res.GetDirectoryEntry().Properties["samaccountname"].Value);
                cover.ProgressStep();
            }
            //cover.ProgressText = "Sorting...";
            UsernameListTerm.Sort();
        }
Beispiel #2
0
        private void buttonUMReloadUserList_Click(object sender, EventArgs e)
        {
            Plexiglass   cover    = new Plexiglass(this);
            formProgress progress = new formProgress(this);

            cover.Show();
            cover.Refresh();
            progress.Show();
            progress.Refresh();
            ADS.UpdateUsernameLists(progress);
            listUMUserHistory.DataSource    = PMCUserAccessHistory();
            comboUMUserSelect.DataSource    = ADS.PopulateUserList(checkUMTerminatedUsers.Checked);
            comboUMUserSelect.SelectedIndex = -1;
            cover.Close();
            progress.Close();
        }