After reading the post by Bob in this thread: http://www.k2underground.com/forums/thread/30745.aspx, I was wondering, 'Can line rules access an Active Directory group stored in a Destination Queue?'.
The situation that I'm trying to answer is in an Infopath Workspace (Starts with a Start Activity then goes to a Infopath Form Submission) I want a line rule to be executed when members of a particular AD Group submit thier form. As I understand it, an Activity can access a Destination Queue via the Activites 'Destintation Rule' property. Is there a way a Line Rule can determine if a user is in a particular group or not? I think I could take email address found in K2.ProcessInstance.Originator.Email or maybe the fully qualified name (K2.ProcessInstance.Originator.FQN) and compare it against AD?
Here's how I would connect to AD in web page:
System.Security.Principal.
WindowsIdentity oUser;oUser = (System.Security.Principal.
WindowsIdentity)HttpContext.Current.User.Identity;System.Security.Principal.
WindowsPrincipal WinPrincp = new System.Security.Principal.WindowsPrincipal(oUser);string strWPName = WinPrincp.Identity.Name.Replace("DOMAIN"", "");
DirectoryEntry entry = new DirectoryEntry("LDAP://");
DirectorySearcher Dsearch = new DirectorySearcher(entry);
Dsearch.Filter =
"(&(objectClass=user)(sAMAccountName=" + strWPName + "))";try
{
foreach (SearchResult sResultSet in Dsearch.FindAll())
{
// email address
if (searchResult.Properties.Contains("mail"))
{
strEmail = searchResult.Propertiese"mail"]m0].ToString();
}
// Compare email address from K2.ProcessInstance.Originator.Email to strEmail and if a match is found, if so then grab groups this user belongs to?
}
}
Is there a preset way that a Line Rule can connect to AD?
J