addition of part of functionality of security groups for organization users

This commit is contained in:
vfedosevich 2013-08-20 18:26:22 +03:00
parent b6d03a3ecb
commit 53dc8efa5d
37 changed files with 3235 additions and 6 deletions

View file

@ -44,6 +44,35 @@ namespace WebsitePanel.Providers.HostedSolution
return de;
}
public static string[] GetUsersGroup(string group)
{
List<string> rets = new List<string>();
DirectorySearcher deSearch = new DirectorySearcher
{
Filter =
("(&(objectClass=user))")
};
SearchResultCollection srcUsers = deSearch.FindAll();
foreach (SearchResult srcUser in srcUsers)
{
DirectoryEntry de = srcUser.GetDirectoryEntry();
PropertyValueCollection props = de.Properties["memberOf"];
foreach (string str in props)
{
if (str.IndexOf(group) != -1)
{
rets.Add(de.Path);
}
}
}
return rets.ToArray();
}
public static bool IsUserInGroup(string samAccountName, string group)
{
bool res = false;