/// ///////////////////////////////////// private void AssureDonnees() { if (m_listeUsers != null) { return; } m_listeUsers = new ArrayList(); try { DirectoryEntry entry = CAdBase.RootEntry; //, m_strUser, m_strPassword); DirectorySearcher searcher = new DirectorySearcher(entry); SearchResultCollection results; searcher.Filter = "(objectCategory=person)"; searcher.PropertiesToLoad.Add(c_champId); searcher.PropertiesToLoad.Add(c_champNom); searcher.PropertiesToLoad.Add(c_champGroups); results = searcher.FindAll(); CAdGroupsServeur groupeServeur = new CAdGroupsServeur(IdSession); foreach (SearchResult result in results) { try { DirectoryEntry entryTrouvee = result.GetDirectoryEntry(); CAdUser user = new CAdUser( entryTrouvee.Properties[c_champId].Value.ToString(), entryTrouvee.Properties[c_champNom].Value.ToString()); if (entryTrouvee.Properties[c_champGroups] != null) { foreach (object obj in entryTrouvee.Properties[c_champGroups]) { CAdGroup group = groupeServeur.GetGroupeFromMemberOfValue(obj.ToString()); if (group != null) { user.Groups.Add(group); } } } m_listeUsers.Add(user); } catch { } } m_listeUsers.Sort(); } catch { m_listeUsers.Clear(); } }
/// ///////////////////////////////////// public CAdUser GetUser(string strId) { AssureDonnees(); if (m_listeUsers.Count == 0) { CAdUser user = new CAdUser(strId, strId); return(user); } foreach (CAdUser user in m_listeUsers) { if (user.Id == strId) { return(user); } } return(null); }