public static IEnumerable<KeyValuePair<string, string>> GetGroupListByAdOrg(AdOrg org) { var list = new Dictionary<string, string>(); using (WindowsImpersonationContextFacade impersonationContext = new WindowsImpersonationContextFacade( nc)) { var domain = new PrincipalContext(ContextType.Domain, "UN1T.GROUP", String.Format("{0}, DC=UN1T,DC=GROUP", AdOrganization.GetAdPathByAdOrg(org))); GroupPrincipal groupList = new GroupPrincipal(domain, "*"); PrincipalSearcher ps = new PrincipalSearcher(groupList); foreach (var grp in ps.FindAll()) { list.Add(grp.Sid.Value, grp.Name); } } return list; }
public static string GetAdPathByAdOrg(AdOrg org) { return GetList().Single(g => g.Org == org).AdPath; }
public IEnumerable<KeyValuePair<string, string>> GetGroupListByAdOrg(AdOrg org) { return AdHelper.GetGroupListByAdOrg(org); }
public AdOrganization(AdOrg org, string path, string name) { Org = org; AdPath = path; Name = name; }